Skip to content

Commit

Permalink
Use gawk's gettimeofday if available #57
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Sep 26, 2021
1 parent 5611da2 commit f2b41d5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Expand Up @@ -39,7 +39,7 @@ jobs:

- name: "run tests"
run: |
brew install gawk
brew install gawk # TODO understand if this step can be cached
./makesure_stable
win:
Expand Down
29 changes: 28 additions & 1 deletion README.md
Expand Up @@ -126,7 +126,34 @@ Valid options: `timing`, `tracing`, `silent`
```
@options timing
```
Will measure and log each goal execution time + total time.
Will measure and log each goal execution time + total time.

Example `Makesurefile`:
```
@options timing
@goal a
@depends_on b
echo "Executing goal 'a' ..."
sleep 1
@goal b
echo "Executing goal 'b' ..."
sleep 2
```

Running:
```
$ ./makesure a
goal 'b' ...
Executing goal 'b' ...
goal 'b' took 2.003 s
goal 'a' ...
Executing goal 'a' ...
goal 'a' took 1.003 s
total time 3.006 s
```

*Small issue exists with this option on macOS.* Due to BSD `date` not supporting `+%N` formatting option the default precision of timings is 1 sec. To make it 1 ms precise (if this is important) just install Gawk (`brew install gawk`). In this case Gawk built-in `gettimeofday` function will be used.
```
@options tracing
```
Expand Down

0 comments on commit f2b41d5

Please sign in to comment.