<commit_before># Resmon

Simple wrapper around `sar(1)`, using `EventEmitter`.

### Install

    npm install resmon

### Usage

    var SAR = require('resmon');
    var daemon = new SAR();
    daemon.on('cpu', function(stat) {
      /* ... */
    });
    daemon.start();

### Events

For details, see `man sar`.

SAR instance emits objects, the keys are field names, the values are arrays, eg. if you have multiple CPU cores:

    var SAR = require('resmon');
    var daemon = new SAR();
    daemon.on('cpu', function(stat) {
      console.log(stat['%usr'][0]);
      //display CPU utilization percentage (at user level) for all CPUs
      //usually the first row contains aggregated (sum, avg, etc.) values
    });

#### cpu
Fields: `CPU`, `%usr`, `%nice`, `%sys`, `%iowait`, `%steal`, `%irq`, `%soft`, `%guest`, `%idle`

#### task
Fields: `proc/s`, `cswch/s`

#### int
Fields: `INTR`, `intr/s`

#### swapPages
Fields: `pswpin/s`, `pswpout/s`

#### page
Fields: `pgpgin/s`, `pgpgout/s`, `fault/s`, `majflt/s`, `pgfree/s`, `pgscank/s`, `pgscand/s`, `pgsteal/s`, `%vmeff`

#### io
Fields: `tps`, `rtps`, `wtps`, `bread/s`, `bwrtn/s`

#### memoryPages
Fields: `frmpg/s`, `bufpg/s`, `campg/s`

#### memory
Fields: `kbmemfree`, `kbmemused`, `%memused`, `kbbuffers`, `kbcached`, `kbcommit`, `%commit`, `kbactive`, `kbinact`

#### swap<commit_msg>Add github syntax highlighting<commit_after># Resmon

Simple wrapper around `sar(1)`, using `EventEmitter`.

### Install

    npm install resmon

### Usage

```js
var SAR = require('resmon');
var daemon = new SAR();
daemon.on('cpu', function(stat) {
  /* ... */
});
daemon.start();
```

### Events

For details, see `man sar`.

SAR instance emits objects, the keys are field names, the values are arrays, eg. if you have multiple CPU cores:

```js
var SAR = require('resmon');
var daemon = new SAR();
daemon.on('cpu', function(stat) {
  console.log(stat['%usr'][0]);
  //display CPU utilization percentage (at user level) for all CPUs
  //usually the first row contains aggregated (sum, avg, etc.) values
});
```

#### cpu
Fields: `CPU`, `%usr`, `%nice`, `%sys`, `%iowait`, `%steal`, `%irq`, `%soft`, `%guest`, `%idle`

#### task
Fields: `proc/s`, `cswch/s`

#### int
Fields: `INTR`, `intr/s`

#### swapPages
Fields: `pswpin/s`, `pswpout/s`

#### page
Fields: `pgpgin/s`, `pgpgout/s`, `fault/s`, `majflt/s`, `pgfree/s`, `pgscank/s`, `pgscand/s`, `pgsteal/s`, `%vmeff`

#### io
Fields: `tps`, `rtps`, `wtps`, `bread/s`, `bwrtn/s`

#### memoryPages
Fields: `frmpg/s`, `bufpg/s`, `campg/s`

#### memory
Fields: `kbmemfree`, `kbmemused`, `%memused`, `kbbuffers`, `kbcached`, `kbcommit`, `%commit`, `kbactive`, `kbinact`

#### swap
{'fraction_non_alphanumeric': 0.22722159730033745, 'fraction_numerical': 0.0014998125234345708, 'mean_word_length': 4.231372549019608, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3533821', 'n_tokens_mistral': 1043, 'n_tokens_neox': 1016, 'n_words': 280}