From f1212176ac7e9831b0f782e19d46db794d9c2252 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Thu, 20 Mar 2014 19:44:31 +0000 Subject: PGO: Add function to reset counters at runtime Adding __llvm_pgo_reset_counters(), which sets all the counters to 0. llvm-svn: 204386 --- compiler-rt/lib/profile/InstrProfiling.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'compiler-rt/lib/profile/InstrProfiling.c') diff --git a/compiler-rt/lib/profile/InstrProfiling.c b/compiler-rt/lib/profile/InstrProfiling.c index c897052d8c4..936b8def38c 100644 --- a/compiler-rt/lib/profile/InstrProfiling.c +++ b/compiler-rt/lib/profile/InstrProfiling.c @@ -8,6 +8,7 @@ \*===----------------------------------------------------------------------===*/ #include "InstrProfiling.h" +#include /* TODO: void __llvm_pgo_get_size_for_buffer(void); */ @@ -34,3 +35,10 @@ void __llvm_pgo_write_buffer(FILE *OutputFile) { I != E; ++I) writeFunction(OutputFile, I); } + +void __llvm_pgo_reset_counters(void) { + uint64_t *I = __llvm_pgo_counters_begin(); + uint64_t *E = __llvm_pgo_counters_end(); + + memset(I, 0, sizeof(uint64_t)*(E - I)); +} -- cgit v1.2.3