]> git.ipfire.org Git - thirdparty/git.git/commit - trace2.h
trace2: add global counter mechanism
authorJeff Hostetler <jeffhost@microsoft.com>
Mon, 24 Oct 2022 13:41:07 +0000 (13:41 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 24 Oct 2022 19:45:26 +0000 (12:45 -0700)
commit81071626ba1ec54ad72de1e0a9a49c78eb87a2c8
tree2b4b5244c2b6f5b24ff586680637b4a7b4f9c7b0
parent8ad575646c0b1e927a05650a1ec64125121ae591
trace2: add global counter mechanism

Add global counters mechanism to Trace2.

The Trace2 counters mechanism adds the ability to create a set of
global counter variables and an API to increment them efficiently.
Counters can optionally report per-thread usage in addition to the sum
across all threads.

Counter events are emitted to the Trace2 logs when a thread exits and
at process exit.

Counters are an alternative to `data` and `data_json` events.

Counters are useful when you want to measure something across the life
of the process, when you don't want per-measurement events for
performance reasons, when the data does not fit conveniently within a
region, or when your control flow does not easily let you write the
final total.  For example, you might use this to report the number of
calls to unzip() or the number of de-delta steps during a checkout.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 files changed:
Documentation/technical/api-trace2.txt
Makefile
t/helper/test-trace2.c
t/t0211-trace2-perf.sh
trace2.c
trace2.h
trace2/tr2_ctr.c [new file with mode: 0644]
trace2/tr2_ctr.h [new file with mode: 0644]
trace2/tr2_tgt.h
trace2/tr2_tgt_event.c
trace2/tr2_tgt_normal.c
trace2/tr2_tgt_perf.c
trace2/tr2_tls.h