pr-1099/jeffhostetler/trace2-stopwatch-v2-v2
tagged this
28 Dec 19:36
Here is version 2 of my series to add stopwatch timers and global counters to Trace2. I think this version address all of the comments made on V1. * I moved the Trace2 "thread_name" field into a flex-array at the bottom of the thread local storage block. This avoids the issue of whether it should be allocated and by whom and its const-ness. * I moved the truncation of the "thread_name" into the "_perf" target (which was the only target that actually cared) so that columns still line up. * Started phasing out the TLS and CTX acronyms in the Trace2 code. There is an ambiguity between "thread local storage" and "transport layer security" that caused some confusion. In this patch series, I eliminated new uses of the TLS term. A future series will be needed to actually rename variables, functions, and data types to fully eliminate the TLS term. * In V1 I included a change to the "_event" target version number. I've rolled this back in favor of Ævar's new proposal describing when/why we change it. (That proposal is independent of this series.) * In V1 I had reported timer values {total, min, max} in floating point seconds with microsecond precision (using a "%9.6f" format) and was internally accumulating interval times in microseconds. After some discussion, I've changed this to accumulate in nanoseconds and report integer nanoseconds. This may avoid some accumulated round off error. (However, on some platforms getnanotime() only has microsecond accuracy, so this increased precision may be misleading.) * Refactor the pattern model used in the unit tests to make it easier to visually parse. * Some cosmetic cleanup of the private timer and counter API. There were additional requests/comments that I have not addressed in this version because I think they should be in their own top-level topic in a future series rather than appended onto this series: * The full elimination of the TLS and CTX terms. * Ævar proposed a new test_trace2 test function to parse trace output. This would be similar to (or a generalization of) the test_region function that we already have in test-lib-functions.sh. * Ævar proposed a large refactor of the "_perf" target to have a "fmt()" varargs function to reduce the amount of copy-n-pasted code in many of the "fn" event handlers. This looks like a good change based on the mockup but is a large refactor. * Ævar proposed a new rationale for when/why we change the "_event" version number. That text can be added to the design document independently. Jeff Hostetler (9): trace2: use size_t alloc,nr_open_regions in tr2tls_thread_ctx trace2: convert tr2tls_thread_ctx.thread_name from strbuf to flex array trace2: defer free of thread local storage until program exit. trace2: add thread-name override to event target trace2: add thread-name override to perf target trace2: add timer events to perf and event target formats trace2: add stopwatch timers trace2: add counter events to perf and event target formats trace2: add global counters Documentation/technical/api-trace2.txt | 157 +++++++++++++++++++++ Makefile | 2 + t/helper/test-trace2.c | 183 +++++++++++++++++++++++++ t/t0211-trace2-perf.sh | 88 ++++++++++++ t/t0212-trace2-event.sh | 86 ++++++++++++ trace2.c | 106 ++++++++++++++ trace2.h | 75 ++++++++++ trace2/tr2_ctr.c | 67 +++++++++ trace2/tr2_ctr.h | 79 +++++++++++ trace2/tr2_tgt.h | 39 ++++++ trace2/tr2_tgt_event.c | 111 +++++++++++---- trace2/tr2_tgt_normal.c | 2 + trace2/tr2_tgt_perf.c | 114 ++++++++++----- trace2/tr2_tls.c | 119 +++++++++++++--- trace2/tr2_tls.h | 51 +++++-- trace2/tr2_tmr.c | 136 ++++++++++++++++++ trace2/tr2_tmr.h | 139 +++++++++++++++++++ 17 files changed, 1465 insertions(+), 89 deletions(-) create mode 100644 trace2/tr2_ctr.c create mode 100644 trace2/tr2_ctr.h create mode 100644 trace2/tr2_tmr.c create mode 100644 trace2/tr2_tmr.h base-commit: e773545c7fe7eca21b134847f4fc2cbc9547fa14 Submitted-As: https://lore.kernel.org/git/pull.1099.v2.git.1640720202.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.1099.git.1640012469.gitgitgadget@gmail.com
Assets 2
-
2021-12-28T19:36:42Z -
2021-12-28T19:36:42Z -