GithubHelp home page GithubHelp logo

qpc-github / gctrack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shopify/gctrack

1.0 2.0 1.0 42 KB

The GCTrack extension lets you monitor incremental GC information

License: MIT License

Ruby 33.77% C 66.23%

gctrack's Introduction

Gem Version Build Status

GCTrack

The GCTrack extension lets you monitor incremental Garbage Collector (GC) information, the GC introduced in Ruby v2.2.

Getting started

#1 Add the dependency

GCTrack is published to rubygems.org. Simply add it as a dependency to your Gemfile

gem 'gctrack', '~> 0.1.1'

#2 Enable the extension

require 'gctrack'

GC::Tracker.enable # returns true, if the Tracker is now enabled

#3 Record data

GC::Tracker.start_record # returns true, if a new record was started
# DO ACTUAL WORK
gc_cycles, gc_duration_ns = GC::Tracker.end_record

#end_record will return the gc_cycles (the amount of gc cycles observed) and gc_duration_ns (their cumulative duration in nanoseconds), since the last invocation of #start_record. You can also invoke #start_record recursively as so:

GC::Tracker.start_record # Start a first record 
do_work_on(one)
GC::Tracker.start_record # Start a second record 
do_work_on(two)
inner_data = GC::Tracker.end_record # Collect results from second record
do_work_on(three)
outter_data = GC::Tracker.end_record # Collect results from first record

In this example, the Array inner_data will only contain the GC information resulted of executing do_work_on(two), while outter_data will contain the GC information resulted from the three exectutions: do_work_on one, two and three.

Effectively, records are stacked and data from a GC cycle will be added to all "currently" records.

License

The MIT License (MIT)

gctrack's People

Contributors

alexsnaps avatar byroot avatar csfrancis avatar

Stargazers

 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.