Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
DrPeterVanNostrand committed Sep 3, 2018
0 parents commit f4cacda
Show file tree
Hide file tree
Showing 4 changed files with 401 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/target
**/*.rs.bk
Cargo.lock
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "cargo-mlocktest"
version = "0.1.0"
authors = ["DrPeterVanNostrand <jnz@riseup.net>"]

[dependencies]

[dev-dependencies]
memsec = "0.5.4"
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# cargo-mlocktest

A cargo subcommand to monitor the ammount of memory locked into RAM during
`cargo test`

**Note: `cargo-mlocktest` only runs on Linux.**

This subcommand is useful when debugging `SIGILL` segfaults that may arise
when testing rust programs that lock large ammounts of memory into RAM.

### Usage

You can use this `cargo` subcommand by running the following:

```
# Install the `mlocktest` subcommand:
$ cd cargo-mlocktest
$ cargo build
$ cp target/debug/cargo-mlocktest ~/.cargo/bin/
# Use the subcommand:
$ cd <different rust project>
$ cargo mlocktest
# When you no longer need the subcommand, run the following to uninstall:
$ rm ~/.cargo/bin/cargo-mlocktest
```

### Output

Running `cargo mlocktest` will run `cargo test`, then output the following
table:

```
Mlock Monitor for `cargo test`
===============================
Locked memory limit (soft, kb): <your systems soft locked memory limit>
Lock memory limit (hard, kb): <your systems hard locked memory limit>
Running `cargo test` ... done!
Process Name Max Locked Memory (kb)
============ ======================
<test 1 binary name> <the max number of kbs locked during test 1>
<test 2 binary name> <the max number of kbs locked during test 2>
...
==============================================================
```
Loading

0 comments on commit f4cacda

Please sign in to comment.