Coder Social home page Coder Social logo

ritsudo's Introduction

Ritsudo

CLI bnechmark tool based on headless chrome. Also measure ajax requests.

Installation

install it yourself as:

$ gem install ritsudo

Usage

CLI

ritsudo -a https://example.com -m "example.com" -u "Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1"

Ruby

#!/usr/bin/env ruby
require "bundler/setup"
require "ritsudo"

ua = "Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1"
collector = Ritsudo::Collector.new(match: /example\.com/)
benchmark = Ritsudo::Benchmark.new(collector: collector)
benchmark.do("https:/www.example.com", driver_options: { user_agent: ua })
benchmark.collector.display

Result

Ritsudo requests 5 times: https://example.com
.....
[Misc]
  +------------------+--------+------+-----+-------+-----------+
  | name             | avg    | max  | min | count | outliters |
  +------------------+--------+------+-----+-------+-----------+
  | DomContentLoaded | 858.6  | 921  | 797 | 5     | 0         |
  +------------------+--------+------+-----+-------+-----------+
  | Loaded           | 1235.6 | 1672 | 975 | 5     | 0         |
  +------------------+--------+------+-----+-------+-----------+

[Document]
  +---------------------------+--------+--------+--------+-------+-------------+-----------+
  | url                       | avg    | max    | min    | count | uncompleted | outliters |
  +---------------------------+--------+--------+--------+-------+-------------+-----------+
  | https://www.example.com/  | 597.56 | 858.15 | 433.51 | 5     | 0           | 0         |
  +---------------------------+--------+--------+--------+-------+-------------+-----------+

[XHR]
  +-------------------------------------------+---------+---------+---------+-------+-------------+-----------+
  | url                                       | avg     | max     | min     | count | uncompleted | outliters |
  +-------------------------------------------+---------+---------+---------+-------+-------------+-----------+
  | https://www.example.com/xhr_request       | 300.39  | 500.39  | 250.39  | 3     | 1           | 1         |
  +-------------------------------------------+---------+---------+---------+-------+-------------+-----------+
  | https://www.example.com/slow_xhr_request  | -       | -       | -       | -     | 5           |           |
  +-------------------------------------------+---------+---------+---------+-------+-------------+-----------+

[Script]
  +--------------------------------+-------+-------+-------+-------+-------------+-----------+
  | url                            | avg   | max   | min   | count | uncompleted | outliters |
  +--------------------------------+-------+-------+-------+-------+-------------+-----------+
  | https//example.com/example.js  | 25.88 | 43.15 | 14.96 | 5     | 0           | 1         |
  +--------------------------------+-------+-------+-------+-------+-------------+-----------+

Set Cookies

ritsudo -a https://example.com/page -m "example.com" -C "hoge=fuga"

Remove outlier

-r option removes outliders outside of (stdev * numeric) value.

ritsudo -a https://example.com/page -m "example.com" -s #{numeric}

Problem

Headless chrome doesn't support to set cookies before access. So, Ritsudo accesses root path(e.g https://example.com) before each benchmark.

License

The gem is available as open source under the terms of the MIT License.

ritsudo's People

Contributors

eudoxa avatar

Watchers

 avatar  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.