https://github.com/uedatakeyuki/erapse
show erapse time of go function
https://github.com/uedatakeyuki/erapse
Last synced: 10 months ago
JSON representation
show erapse time of go function
- Host: GitHub
- URL: https://github.com/uedatakeyuki/erapse
- Owner: UedaTakeyuki
- Created: 2020-07-06T04:58:36.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-08T06:26:09.000Z (over 1 year ago)
- Last Synced: 2025-01-30T15:33:38.393Z (11 months ago)
- Language: Go
- Size: 14.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# erapse : show elapsed time of go function
## How to use
Import **time** and **github.com/UedaTakeyuki/erapse** and just call ```defer erapse.ShowErapsedTIme(time.Now())``` at the beginning of the function you want to measure elapsed time, that it! Fx:
```
import (
"time"
"github.com/UedaTakeyuki/erapse"
)
func DoSomething(){
defer erapse.ShowErapsedTIme(time.Now())
```
The result is as follows:
```
eraps main.DoSomething: 1896985 μs
```
## Measurement error
On **Intel PC**, The **ShowErapsedTIme** itself consumes **several microseconds**.
On **RPi**, this consumes **several tens of microseconds**.
See the ``go test -v -run Test_04`` under the **test** folder for more details.
## By the way, why is "erapse" spelt R? Why not L of "elapse"?
Due to my mother language being Japanese which doesn't have a difference in pronunciation between **R** and **L**, I carelessly misspelt it. ^^;
By the time I noticed the mistake, I had already used it a lot, so it was hard to correct the spelling now, so I thought it was okay and left it as is.
I'm sure there are many other typos and grammatical errors in the document I wrote, so please feel free to point them out. Thx!
## for other language
**C++** version is available at https://github.com/UedaTakeyuki/elapse.
## history
- 2020.07.06 created from scratch
- 2024.05.31 add test, IsShow