Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chneau/tt
a simple time tracker for go
https://github.com/chneau/tt
chronometer development golang timer
Last synced: about 6 hours ago
JSON representation
a simple time tracker for go
- Host: GitHub
- URL: https://github.com/chneau/tt
- Owner: chneau
- License: mit
- Created: 2018-06-22T12:27:20.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-02T15:22:11.000Z (about 6 years ago)
- Last Synced: 2024-06-20T03:56:54.600Z (5 months ago)
- Topics: chronometer, development, golang, timer
- Language: Go
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tt
A simple time tracker for go in arround 40 lines of code.
Allows you to quickly check how much time a function takes to run.## Doc
https://godoc.org/github.com/chneau/tt## Install
```bash
go get github.com/chneau/tt
```## Usage
Simply add `defer tt.T()()` to a function to know how much times the function takes to finish (from the line you have written `defer tt.T()()`).
## Example
###### Code
```go
// GetDataStatic Return static data
func GetDataStatic() []Load {
defer tt.Track(time.Now(), "GetDataStaticLoads") // This
defer tt.T()() // This one is a shorthand
f, _ := fs.New()
file, _ := f.Open("/loads.gob")
dec := gob.NewDecoder(file)
v := []Load{}
dec.Decode(&v)
return v
}
```
###### Output
```
[TRACK] 2018/08/03 12:12:03 <[main.GetDataStatic]> 75.563159ms
[TRACK] 2018/08/03 12:12:03 <[GetDataStaticLoads]> 75.563159ms
```