Listing 2. The GAUGER macro makes it
easy to integrate Gauger with C code.
Note that the code does not need to be
linked against any additional libraries
(other than libc).
#include <gauger.h> #include <time.h>
int main() { time_t start = time (NULL); do_test (); time_t delay = time (NULL) - start; GAUGER ("subsystem", "execution time for f", delay, "s"); return 0; }
measurement to the server. On systems
where the Gauger client is not installed,
the call fails silently so as not to disrupt
normal operations in any way. The
syntax of the Gauger client command-line tool is as follows:
gauger [-i ID] -c CATEGORY -n NAME \ -u UNIT -d DATA
Here, NAME is the name of the metric, and DATA is any floating-point
value that represents the performance
measurement. UNIT is a string that
describes the unit of the value, for
example, ms/request. CATEGORY is a
string used to group multiple performance metrics by subsystem. We
Listing 3. A simple static method call,
leading to a single line of Java code, can
be used to invoke Gauger from Java.
import static org.gnunet.gauger.Gauger.gauger;
class HelloGauger { public static void main(String[] args) { gauger ("subsystem", "Speed", 42 /* value */, "kb/s");
}
}
recommend using the name of the
subsystem or module here, especially
for larger projects.
Revision Numbers
Gauger can autodetect the current
revision of the project if the benchmark is executed in a directory that
was checked out from a supported
Version Control System (VCS). The
supported VCSes are Subversion, Git,
hg, bazaar, monotone and GNU arch.
For distributed VCSes that do not provide an ascending revision numbering
system (like Git), Gauger uses the
number of commits to the repository.
In this case, all execution hosts used
for benchmarking should use the same
origin to keep the data consistent. If
the project uses an unsupported VCS
or if the benchmark is executed outside the tree, Gauger needs to know
which (revision) number to use for the