[PATCH] D52047: [clangd] Add building benchmark and memory consumption tracking

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 21 06:42:33 PDT 2018


lebedev.ri added inline comments.


================
Comment at: clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp:81
+// Same for the next "benchmark".
+// FIXME(kbobyrev): Should this be separated into the BackingMemorySize
+// (underlying SymbolSlab size) and Symbol Index (MemIndex/Dex) overhead?
----------------
kbobyrev wrote:
> ilya-biryukov wrote:
> > Given the trick we use for display, how are we going to show **two** memory uses?
> As discussed offline, this hack also relies on the fact that benchmark has a dynamic nature of determining iterations count. Giving a large number of "time units" to the  counter results in a single iteration.
> 
> I've tried to understand whether I could use any flags for [[ https://github.com/google/benchmark#user-defined-counters | User-Defined Counter ]] that could just divide the number of iterations by `IterationTime`, but I could find one that would do exactly what is needed here. Also, I didn't find any way to manually set the iteration count.
> divide the number of iterations by IterationTime
And more unsolicited advices:
[[ https://github.com/google/benchmark/blob/1b44120cd16712f3b5decd95dc8ff2813574b273/include/benchmark/benchmark.h#L366-L368 | `kIsIterationInvariantRate` ]], but it is master-only, not in any release.
For now, do
```
State.counters["kIsIterationInvariantRate"] = benchmark::Counter(
                                                state.iterations(),
                                                benchmark::Counter::Flags::kIsRate);
```
If understood the question right.

> Also, I didn't find any way to manually set the iteration count.
[[ https://github.com/google/benchmark/blob/1b44120cd16712f3b5decd95dc8ff2813574b273/include/benchmark/benchmark.h#L853-L859 | `benchmark::Benchmark::Iterations()` ]]



https://reviews.llvm.org/D52047





More information about the cfe-commits mailing list