Git Product home page Git Product logo

phantomas's Introduction

phantomas

GitHub Logo

PhantomJS-based modular web performance metrics collector.

And why phantomas? Well, because :)

Requirements

Dependencies

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

Let's make Web a bit faster!

Usage

Single run

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

Parameters

  • --url URL of the page to generate metrics for (required)
  • --format=[json|csv|plain] output format (plain is the default one)
  • --timeout=[seconds] timeout for phantomas run (defaults to 15 seconds)
  • --viewport=[width]x[height] phantomJS viewport dimensions (1280x1024 is the default)
  • --verbose writes debug messages to the console
  • --silent don't write anything to the console
  • --modules=[moduleOne],[moduleTwo] run only selected modules

Multiple runs

This helper script requires NodeJS.

./run-multiple.js --url=https://github.com/macbre/phantomas  --runs=5

Parameters

  • --url URL of the page to generate metrics for (required)
  • --runs number of runs to perform (defaults to 3)
  • --modules=[moduleOne],[moduleTwo] run only selected modules

Features

  • Modular approach - each metric is generated by a separate "module"
  • phantomas "core" acts as an events emitter that each module can hook into
  • JSON and CSV as available output formats for easy integration with automated reporting / monitoring tools

Metrics

Current number of metrics: 61

Units:

  • ms for time
  • bytes for size
phantomjs phantomas.js --url=https://github.com/macbre/phantomas

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

* requests: 22
* gzipRequests: 9
* redirects: 0
* notFound: 0
* timeToFirstByte: 503
* timeToLastByte: 520
* bodySize: 675125
* contentLength: 708206
* htmlCount: 1
* htmlSize: 50728
* cssCount: 2
* cssSize: 174949
* jsCount: 4
* jsSize: 322932
* imageCount: 12
* imageSize: 49287
* base64Count: 0
* base64Size: 0
* otherCount: 3
* otherSize: 77229
* cacheHits: 0
* cacheMisses: 0
* cachingNotSpecified: 3
* cachingTooShort: 2
* cachingDisabled: 0
* headersCount: 265
* headersSentCount: 65
* headersRecvCount: 200
* headersSize: 10205
* headersSentSize: 3850
* headersRecvSize: 6355
* assetsNotGzipped: 0
* assetsWithQueryString: 9
* httpTrafficCompleted: 2460
* domains: 5
* DOMqueries: 39
* DOMinserts: 19
* jQuerySelectors: 0
* jQueryOnDOMReadyFunctions: 0
* cookiesSent: 0
* cookiesRecv: 268
* domainsWithCookies: 1
* documentCookiesLength: 387
* documentCookiesCount: 12
* bodyHTMLSize: 47769
* commentsSize: 452
* hiddenContentSize: 15635
* whiteSpacesSize: 2378
* DOMelementsCount: 554
* DOMelementMaxDepth: 13
* iframesCount: 0
* nodesWithInlineCSS: 5
* globalVariables: 18
* localStorageEntries: 0
* smallestResponse: 35
* biggestResponse: 239453
* fastestResponse: 43
* slowestResponse: 984
* medianResponse: 130.5
* onDOMReadyTime: 482
* windowOnLoadTime: 1716

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)
  • httpTrafficCompleted: 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

Cookies

  • cookiesSent: length of cookies sent in HTTP requests
  • cookiesRecv: length of cookies received in HTTP responses
  • domainsWithCookies: number of domains with cookies set
  • documentCookiesLength: length of document.cookie
  • documentCookiesCount: number of cookies in document.cookie

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
  • DOMelementsCount: total number of HTML element nodes
  • DOMelementMaxDepth: maximum level on nesting of HTML element node
  • iframesCount: number of iframe nodes
  • nodesWithInlineCSS: number of nodes with inline CSS styling (with style attribute)

DOM queries

  • DOMqueries: number of document.getElementById and document.getElementsByClassName calls
  • DOMinserts: number of DOM nodes inserts
  • jQuerySelectors: number of jQuery selectors calls (e.g. $('#foo > .bar'))
  • jQueryOnDOMReadyFunctions: number of functions bound to onDOMready event

Window performance

  • onDOMReadyTime: time it took to fire onDOMready event
  • windowOnLoadTime: time it took to fire window.load event

Requests statistics

  • smallestResponse: the size of the smallest response
  • biggestResponse: the size of the biggest response
  • fastestResponse: the time to the last byte of the fastest response
  • slowestResponse: the time to the last byte of the slowest response
  • medianResponse: median value of time to the last byte for all responses

localStorage

  • localStorageEntries: number of entries in local storage

Static assets

  • assetsNotGzipped: static assets that were not gzipped
  • assetsWithQueryString: static assets requested with query string (e.g. ?foo) in URL

Caching

  • cachingNotSpecified: responses with no caching header sent (either Cache-Control or Expires)
  • cachingTooShort: responses with too short (less than a week) caching time
  • cachingDisabled: responses with caching disabled (max-age=0)

Notices

phantomas apart from "raw" metrics data, when in --verbose mode, emits notices with more in-depth data:

> Caching period is less than a week for <https://ssl.google-analytics.com/ga.js> (set to 43200 s)
> No caching specified for <https://secure.gaug.es/track.js>
> Caching period is less than a week for <https://secure.gravatar.com/avatar/57548e3255bfa0e74afff98289dae839?s=140&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png> (set to 300 s)
> https://secure.gravatar.com/avatar/57548e3255bfa0e74afff98289dae839?s=140&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png (IMAGE) served with query string
> Requests per domain:
>  github.com: 1 request(s)
>  a248.e.akamai.net: 16 request(s)
>  ssl.google-analytics.com: 2 request(s)
>  secure.gaug.es: 2 request(s)
>  secure.gravatar.com: 1 request(s)
>
> JavaScript globals (18): html5, Modernizr, moment, $, jQuery, $stats, jQuery18302483161953277886, GitHub, DateInput, clippyCopiedCallback, debug, _gaq, _gauges, CommandBar, stringDistance, fuzzyScore, _gat, gaGlobal
>
> The smallest response (0.03 kB): https://ssl.google-analytics.com/__utm.gif?utmwv=5.3.8&utms=1&utmn=396347331&utmhn=github.com&utmcs=UTF-8&utmsr=1024x768&utmvp=1024x1280&utmsc=32-bit&utmul=pl-pl&utmje=0&utmfl=-&utmdt=macbre%2Fphantomas%20%C2%B7%20GitHub&utmhid=1963809109&utmr=-&utmp=%2Fmacbre%2Fphantomas&utmac=UA-3769691-2&utmcc=__utma%3D1.1523233271.1353260190.1353260190.1353260190.1%3B%2B__utmz%3D1.1353260190.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmu=qB~
> The biggest response (233.84 kB): https://a248.e.akamai.net/assets.github.com/assets/github-81433815e4751f68e04d42ec948cba14ab028c2d.js
>
> The fastest response (43 ms): https://a248.e.akamai.net/assets.github.com/images/modules/header/[email protected]?1340659561
> The slowest response (984 ms): https://secure.gravatar.com/avatar/57548e3255bfa0e74afff98289dae839?s=140&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png

For developers

phantomas's People

Contributors

macbre avatar jgonera avatar

Watchers

Jonathan Mosney avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.