Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jehy/trace-timer
https://github.com/jehy/trace-timer
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jehy/trace-timer
- Owner: jehy
- License: mit
- Created: 2019-10-17T13:37:42.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-18T11:55:24.000Z (about 5 years ago)
- Last Synced: 2024-04-14T11:05:30.766Z (7 months ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Trace timer
[![npm](https://img.shields.io/npm/v/trace-timer.svg)](https://npm.im/trace-timer)
[![license](https://img.shields.io/npm/l/trace-timer.svg)](https://npm.im/trace-timer)
[![Build Status](https://travis-ci.org/jehy/trace-timer.svg?branch=master)](https://travis-ci.org/jehy/trace-timer)
[![Coverage Status](https://coveralls.io/repos/github/jehy/trace-timer/badge.svg?branch=master)](https://coveralls.io/github/jehy/trace-timer?branch=master)
[![dependencies Status](https://david-dm.org/jehy/trace-timer/status.svg)](https://david-dm.org/jehy/trace-timer)
[![devDependencies Status](https://david-dm.org/jehy/trace-timer/dev-status.svg)](https://david-dm.org/jehy/trace-timer?type=dev)
[![Known Vulnerabilities](https://snyk.io/test/github/jehy/trace-timer/badge.svg)](https://snyk.io/test/github/jehy/trace-timer)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/jehyrus)Simple timer to trace your graph-like complex async code.
### Install
```bash
npm install trace-timer
```### Use
```js
const TraceTimer = require('trace-timer')
timer = new TraceTimer('someName', null, false);
const timer1 = new TraceTimer('someChild1', null, false);
timer1.countSync(()=>clock.tick(100));
const timer2 = new TraceTimer('someChild2', null, false);
timer2.countAsync(async()=>clock.tick(100));
timer.addChild(timer1);
timer.addChild(timer2);
console.log(timer);```