<commit_before>phantomas
=========

PhantomJS-based modular web performance metrics collector

## Requirements

* [PhantomJS](http://phantomjs.org/)

## Dependencies

phantomas uses the following 3rd party libraries (located in `/lib` directory):

* [phantomjs-nodify](https://github.com/jgonera/phantomjs-nodify)
* [DOM monster](https://github.com/madrobby/dom-monster)

## Usage

``` bash
phantomjs phantomas.js --url=http://phantomjs.org --verbose
```

### Parameters

* `--url` URL of the page to generate metrics for (required)
* `--format=[json|plain]` output format (plain is the default one)
* `--viewport=[width]x[height]` phantomJS viewport dimensions (1280x1024 is the default)
* `--verbose` writes debug messages to the console

## Features

* Modular approach - each metric is generated by a separate "module"
* phantomas "core" acts as an [events emitter](https://github.com/macbre/phantomas/wiki/Events) that each module can hook into
* JSON and CSV as available output formats for easy integration with automated reporting / monitoring tools

## Metrics

TODO

## For developers

* [Project's wiki](https://github.com/macbre/phantomas/wiki)
* Description of [events fired by phantomas core](https://github.com/macbre/phantomas/wiki/Events)
* [TODO list](https://github.com/macbre/phantomas/wiki/TODO)<commit_msg>Metrics updated in README file<commit_after>phantomas
=========

PhantomJS-based modular web performance metrics collector

## Requirements

* [PhantomJS](http://phantomjs.org/)

## Dependencies

phantomas uses the following 3rd party libraries (located in `/lib` directory):

* [phantomjs-nodify](https://github.com/jgonera/phantomjs-nodify)
* [DOM monster](https://github.com/madrobby/dom-monster)

## Usage

``` bash
phantomjs phantomas.js --url=https://github.com/macbre/phantomas  --verbose
```

### Parameters

* `--url` URL of the page to generate metrics for (required)
* `--format=[json|plain]` output format (plain is the default one)
* `--viewport=[width]x[height]` phantomJS viewport dimensions (1280x1024 is the default)
* `--verbose` writes debug messages to the console

## Features

* Modular approach - each metric is generated by a separate "module"
* phantomas "core" acts as an [events emitter](https://github.com/macbre/phantomas/wiki/Events) that each module can hook into
* JSON and CSV as available output formats for easy integration with automated reporting / monitoring tools

## Metrics

Units:

* ms for time
* bytes for size

``` 
phantomjs phantomas.js --url=https://github.com/macbre/phantomas  --verbose

phantomas metrics for <https://github.com/macbre/phantomas>:

* requests: 25
* gzipRequests: 10
* redirects: 1
* notFound: 0
* timeToFirstByte: 473
* timeToLastByte: 480
* bodySize: 505545
* contentLength: 505545
* htmlCount: 2
* htmlSize: 37869
* cssCount: 2
* cssSize: 179261
* jsCount: 3
* jsSize: 131764
* imageCount: 13
* imageSize: 45177
* base64Count: 0
* base64Size: 0
* otherCount: 5
* otherSize: 111474
* cacheHits: 0
* cacheMisses: 0
* headersCount: 316
* headersSentCount: 76
* headersRecvCount: 240
* headersSize: 12215
* headersSentSize: 4521
* headersRecvSize: 7694
* httpRequestsDone: 1776
* domains: 5
* globalVariables: 15
* bodyHTMLSize: 36636
* commentsSize: 901
* hiddenContentSize: 15102
* whiteSpacesSize: 2298
* onDOMReadyTime: 136
* windowOnLoadTime: 1185
```

### Requests monitor

* requests: total number of HTTP requests made
* gzipRequests: number of gzipped HTTP responses
* redirects: number of HTTP redirects (either 301 or 302)
* notFound: number of HTTP 404 responses
* timeToFirstByte: time it took to receive the first byte of the first response
* timeToLastByte: time it took to receive the last byte of the first response
* bodySize: size of the content of all responses
* contentLength: size of the content of all responses (based on ``Content-Length`` header)
* httpRequestsDone: time it took to receive the last byte of the last HTTP response

### Assets types

* htmlCount: number of html responses
* htmlSize: size of html responses
* cssCount: number of css responses
* cssSize: size of css responses
* jsCount: number of js responses
* jsSize: size of js responses
* imageCount: number of image responses
* imageSize: size of image responses
* base64Count: number of base64 encoded "responses" (no HTTP request was made)
* base64Size: size of base64 encoded "responses"
* otherCount: number of other responses
* otherSize: size of other responses

### Cache Hits

_Metrics are calculated based on ``X-Cache`` header added by Varnish  / Squid servers._

* cacheHits: number of cache hits
* cacheMisses: number of cache misses

### Headers

* headersCount: number of requests and responses headers
* headersSentCount: number of headers sent in requests
* headersRecvCount: number of headers received in responses
* headersSize: size of all headers
* headersSentSize: size of sent headers
* headersRecvSize: size of received headers

### Domains

* domains: number of domains used to fetch the page

### DOM complexity

* globalVariables: number of JS globals variables
* bodyHTMLSize: the size of body tag content
* commentsSize: the size of HTML comments on the page
* hiddenContentSize: the size of content of hidden elements on the page (with CSS ``display: none``)
* whiteSpacesSize: the size of text nodes with whitespaces only
* onDOMReadyTime: time it took to fire onDOMready event
* windowOnLoadTime: time it took to fire window.load event

## For developers

* [Project's wiki](https://github.com/macbre/phantomas/wiki)
* Description of [events fired by phantomas core](https://github.com/macbre/phantomas/wiki/Events)
* [TODO list](https://github.com/macbre/phantomas/wiki/TODO)
{'fraction_non_alphanumeric': 0.10319410319410319, 'fraction_numerical': 0.026851526851526853, 'mean_word_length': 4.9426485922836285, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 15, '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': '6656634', 'n_tokens_mistral': 1832, 'n_tokens_neox': 1662, 'n_words': 621}