gastracker
Track the gas costs of your functions over time.
Last updated a year ago by gorgos .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gastracker 
SYNC missed versions from official npm registry.

gastracker

A simple utility for tracking gas costs of your Solidity contracts.

Getting Started

npm install gastracker --save-dev

Usage

Inside your testing code

const { createProxyContract, storeResults } = require('gastracker')

beforeEach(async () => {
  this.token = createProxyContract(await SimpleToken.new(), 'SimpleToken')
})

after(() => {
  if (process.env.STORE_GAS_RESULTS === 'true') storeResults('./data.json')
})

Command-line tool for printing results

$ printGasHistory --help
Usage: printGasHistory [options]

Options:
  -V, --version                       output the version number
  -f, --file-name <fileName>          data file with stored gas results
  -c, --contract-name <contractName>  the name of the target contract
  -n, --function-name <functionName>  the name of the target function
  -s, --stats-name <statsName>        the statistic name (mean, median, min, max)
  -h, --help                          output usage information

Example

$ printGasHistory -f data.json -c SimpleToken -n transferTest -s mean

screenshot

API

createProxyContract(targetContract, referenceName)

Create a proxy for the target contract and store information under given reference name. Can be used in beforeEach hook.

storeResults(fileName)

Append results of the tracking to given file name. Can be used in after hook.

getGasResults()

Receive the current results from the tracking of all proxy contracts.

Built With

  • Commander - The complete solution for node.js command-line interfaces
  • asciicharts - Console ASCII line charts in pure Javascript
  • stats-lite - A fairly light statistical package.

Contributing

Please feel free to create PR's or issues.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Current Tags

  • 1.0.1                                ...           latest (a year ago)

2 Versions

  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |