[scudo] Add a Timer class to assist performance measurement
authorChia-hung Duan <chiahungduan@google.com>
Thu, 23 Mar 2023 19:38:48 +0000 (19:38 +0000)
committerChia-hung Duan <chiahungduan@google.com>
Thu, 23 Mar 2023 19:40:15 +0000 (19:40 +0000)
commite0361396c2281a108a36d186161ace1843925431
tree4b4148d7f487da3499814f206cc250dd1c5f23f4
parent30e89166d765cbe676fdc85bc653df9a3c09ce48
[scudo] Add a Timer class to assist performance measurement

Add Timer and TimingManager which provide convenient way to meause the
execution time of code snippets. The output looks like,

```
-- Average Operation Time -- -- Name (# of Calls) --
          1747.2(ns)            popBatch (59)
            92.3(ns)            popBatchImpl (73)
           101.6(ns)              EmptyBatchProcess (5)
          2587.0(ns)            pushBlocksImpl (13)
```

Note that `EmptyBatchProcess` is nested under the timer `popBatchImpl`.

Reviewed By: cferris

Differential Revision: https://reviews.llvm.org/D143626
compiler-rt/lib/scudo/standalone/CMakeLists.txt
compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
compiler-rt/lib/scudo/standalone/tests/timing_test.cpp [new file with mode: 0644]
compiler-rt/lib/scudo/standalone/timing.cpp [new file with mode: 0644]
compiler-rt/lib/scudo/standalone/timing.h [new file with mode: 0644]