Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dustin/testingbee
Port of Go's testing.B to C
https://github.com/dustin/testingbee
Last synced: about 2 months ago
JSON representation
Port of Go's testing.B to C
- Host: GitHub
- URL: https://github.com/dustin/testingbee
- Owner: dustin
- License: other
- Created: 2012-06-27T17:26:59.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2016-05-02T23:49:52.000Z (over 8 years ago)
- Last Synced: 2024-10-11T14:15:53.869Z (2 months ago)
- Language: C
- Size: 10.7 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
# Testing Bee
This is a port of go's [testing.B][testbee] benchmark tool. The
example will show you a specific use of it. Go's manual provides a
good overview.## Usage
The usage is modeled after [testing.B][testbee], but in short, the
framework will decide how many times your test should run a loop by
probing it a few times until it runs long enough to provide meaningful
results. Your code just runs that number of times.e.g.
```C
void test_thing(bee_t *b) {
for (int i = 0; i < b->n; i++) {
// do the thing that takes the time
}
}int main(int argc, char **argv) {
bench("thing", test_thing);
}
```That's pretty much it. You can call `fail_test(bee_t*)` to indicate
your test didn't succeed, and `stop_timer(bee_t*)` to stop the timer
for a bit while you set up something expensive or perhaps to do
something expensive after your loop you don't want considered part of
the execution. `start_timer(bee_t*)` to restart the timer after
stopping it, or perhaps just `reset_timer(bee_t*)` to clear the timer
between your setup and your test loop.[testbee]: http://golang.org/pkg/testing/