🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

github.com/art4711/timers

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/art4711/timers

v0.0.0-20140213120041-9dcf6f51aa79
Source
Go
Version published
Created
Source

Timers

Timers is a simple framework for accumulating timing data in applications in a hierarchical way to keep track of how much time gets spent in various parts of the code.

How to use this in practice:

allTimers := New()
t = allTimers
t = t.Start("foo")
foo()
t = t.Handover("bar")
bar(t)
t = t.Stop()
func bar(t timers.Timer) {
     t = t.Start("a")
     a()
     t = t.Handover("b")
     b()
}

This will create a structue with timers as: foo bar bar.a bar.b

You can then use Foreach to collect the data from the timers.

Allocating the timer with NewMemStats() will also record some memory usage statistics along with timing data, but keep in mind that this makes the timers a magnitude slower.

FAQs

Package last updated on 13 Feb 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts