# docpad-plugin-cpuprofiler

> Creates cpu snapshots for specified start and stop events in docpad, viewable in the chrome profiler

Latest version **2.1.1** (published 2015-09-08) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install docpad-plugin-cpuprofiler
pnpm add docpad-plugin-cpuprofiler
yarn add docpad-plugin-cpuprofiler
bun add docpad-plugin-cpuprofiler
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.1.1 |
| Published | 2015-09-08 |
| First published | 2015-03-22 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Stringz Solutions Ltd |
| Maintainers | pflannery |
| Keywords | docpad, docpad-plugin, analysis, cpu, profile |

## Links

- npm: https://www.npmjs.com/package/docpad-plugin-cpuprofiler
- Repository: https://github.com/pflannery/docpad-plugin-cpuprofiler
- Homepage: http://docpad.org/plugin/cpuprofiler
- Issues: https://github.com/pflannery/docpad-plugin-cpuprofiler/issues
- npm.io page: https://npm.io/package/docpad-plugin-cpuprofiler

## Dependencies (1)

- [v8-profiler](https://npm.io/package/v8-profiler.md) ^5.3.0

## Recent versions

- 2.1.1 (latest) — 2015-09-08
- 2.1.0 — 2015-09-08
- 2.0.3 — 2015-03-22
- 2.0.2 — 2015-03-22
- 2.0.1 — 2015-03-22
- 2.0.0 — 2015-03-22

## README

# CPU profiler Plugin for [DocPad](http://docpad.org)

[![NPM version](https://badge.fury.io/js/docpad-plugin-cpuprofiler.png)](https://npmjs.org/package/docpad-plugin-cpuprofiler "View this project on NPM")
[![Dependency Status](https://gemnasium.com/pflannery/docpad-plugin-cpuprofiler.png)](https://gemnasium.com/pflannery/docpad-plugin-cpuprofiler)
[![Gittip donate button](http://img.shields.io/gittip/pflannery.png)](https://www.gittip.com/pflannery/ "Donate weekly to this project using Gittip")
[![Analytics](https://ga-beacon.appspot.com/UA-47157500-1/docpad-plugin-cpuprofiler/readme)](https://github.com/pflannery/docpad-plugin-cpuprofiler)

Generates cpu snapshots using [v8-profiler](https://github.com/node-inspector/v8-profiler) during specified docpad events that can be loaded in to the chrome profiler.
Snapshot files are generated in the root of docpad under 'snapshots' folder by default

## Config

```
plugins:
  cpuprofiler:
    # default output path relative to the docpad root path
    snapshotPath: "snapshots"

    # events that this plugin can start and stop recording from (change to suit your docpad instance)
    # default settings
    events: [
      {
        start: 'generateBefore',  # event to start recording
        stop:'generateAfter',     # event to stop recording
        recordSamples: false      # passes the record_samples (flame data) boolean flag to the profiler, default is false
      }
    ]
```

## Capturing Multiple Events Example
```
plugins:
  cpuprofiler:
    # default output path relative to the docpad root path
    snapshotPath: "snapshots"

    events: [
      {start: 'generateBefore',               stop:'generateAfter'},
      {start: 'parseBefore',                  stop:'parseAfter'},
      {start: 'populateCollectionsBefore',    stop:'populateCollections'},
      {start: 'contextualizeBefore',          stop:'contextualizeAfter'},
      {start: 'renderBefore',                 stop:'renderAfter'},
      {start: 'renderCollectionBefore',       stop:'renderCollectionAfter'},
      {start: 'writeBefore',                  stop:'writeAfter'},
      {start: 'serverBefore',                 stop:'serverAfter'}
    ]
```

## Capture across events
```
plugins:
  cpuprofiler:
    # default output path relative to the docpad root path
    snapshotPath: "snapshots"
    events: [
      {start: 'generateBefore',               stop:'writeAfter'}
    ]
```

```
Some of the events that can be specified
  'generateBefore'
  'generateAfter'
  'parseBefore'
  'parseAfter'
  'populateCollectionsBefore'
  'populateCollections'
  'contextualizeBefore'
  'contextualizeAfter'
  'renderBefore'
  'renderAfter'
  'renderCollectionBefore'
  'renderCollectionAfter'
  'writeBefore'
  'writeAfter' # (default)
  'serverBefore'
  'serverAfter'
```

[Full event list is here](https://github.com/docpad/docpad/blob/v6.78.1/src/lib/docpad.coffee#L239-L265)

## Tips

Good advice here: 

- [Memory Management Masterclass with Addy Osmani](https://www.youtube.com/watch?v=LaxbdIyBkL0)
- [How to use the profiler in chrome](https://developers.google.com/chrome-developer-tools/docs/javascript-memory-profiling)

## History
[You can discover the history inside the `History.md` file](https://github.com/pflannery/docpad-plugin-cpuprofiler/blob/master/History.md#files)

## Contributing
[You can discover the contributing instructions inside the `Contributing.md` file](https://github.com/bevry/docpad-plugin-cpuprofiler/blob/master/Contributing.md#files)

## License
Licensed under the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT License](http://creativecommons.org/licenses/MIT/)
<br/>Copyright &copy; 2015+ Stringz Solutions Ltd
<br/>Copyright &copy; 2015+ [Peter Flannery](http://github.com/pflannery)

---
_Source: https://npm.io/package/docpad-plugin-cpuprofiler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
