<commit_before><h1 align="center">gcstats.js</h1>
<p align="center">Exposes stats about V8 GC after it has been executed.</p>

[![Build Status](https://travis-ci.org/bripkens/gcstats.js.svg?branch=master)](https://travis-ci.org/bripkens/gcstats.js)

## Usage

Create a new instance of the module and subscribe to `stats`-events from that:

```javascript
var gcStats = require('gcstats.js');

gcStats.on('stats', function(stats) {
  console.log(stats);
});
```

This will print blobs like this whenever a GC happens:

```json
{
  "start": 271925068593439,
  "end": 271925070343402,
  "gctype": 1,
  "before": {
    "totalHeapSize": 10481664,
    "totalHeapExecutableSize": 5242880,<commit_msg>Improve readme structure<commit_after># proxrox &nbsp; [![Build Status](https://travis-ci.org/bripkens/gcstats.js.svg?branch=master)](https://travis-ci.org/bripkens/gcstats.js) [![Dependency Status](https://david-dm.org/bripkens/gcstats.js/master.svg)](https://david-dm.org/bripkens/gcstats.js/master) [![npm version](https://badge.fury.io/js/gcstats.js.svg)](https://badge.fury.io/js/gcstats.js)

Exposes statistics about V8 garbage collections (GCs) after they have been executed.

---

<!-- TOC depthFrom:2 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->

- [Usage](#usage)
- [Property insights](#property-insights)
- [Installation](#installation)
- [Node version compatibility](#node-version-compatibility)
- [Credits](#credits)

<!-- /TOC -->


## Usage

Create a new instance of the module and subscribe to `stats`-events from that:

```javascript
var gcStats = require('gcstats.js');

gcStats.on('stats', function(stats) {
  console.log(stats);
});
```

This will print blobs like this whenever a GC happens:

```json
{
  "start": 271925068593439,
  "end": 271925070343402,
  "gctype": 1,
  "before": {
    "totalHeapSize": 10481664,
    "totalHeapExecutableSize": 5242880,
{'fraction_non_alphanumeric': 0.17136774880255454, 'fraction_numerical': 0.05375199574241618, 'mean_word_length': 5.0256410256410255, 'pattern_counts': {'":': 12, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 8, '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': '1104812', 'n_tokens_mistral': 749, 'n_tokens_neox': 672, 'n_words': 138}