forked from OSchip/llvm-project
PGO: Add function to reset counters at runtime
Adding __llvm_pgo_reset_counters(), which sets all the counters to 0. <rdar://problem/15943240> llvm-svn: 204386
This commit is contained in:
parent
b9eab6d1c8
commit
f1212176ac
|
@ -8,6 +8,7 @@
|
|||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#include "InstrProfiling.h"
|
||||
#include <string.h>
|
||||
|
||||
/* 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));
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef struct __llvm_pgo_data {
|
|||
const uint32_t NumCounters;
|
||||
const uint64_t FuncHash;
|
||||
const char *const Name;
|
||||
const uint64_t *const Counters;
|
||||
uint64_t *const Counters;
|
||||
} __llvm_pgo_data;
|
||||
|
||||
/* TODO: void __llvm_pgo_get_size_for_buffer(void); */
|
||||
|
@ -55,5 +55,5 @@ const __llvm_pgo_data *__llvm_pgo_data_begin();
|
|||
const __llvm_pgo_data *__llvm_pgo_data_end();
|
||||
const char *__llvm_pgo_names_begin();
|
||||
const char *__llvm_pgo_names_end();
|
||||
const uint64_t *__llvm_pgo_counters_begin();
|
||||
const uint64_t *__llvm_pgo_counters_end();
|
||||
uint64_t *__llvm_pgo_counters_begin();
|
||||
uint64_t *__llvm_pgo_counters_end();
|
||||
|
|
|
@ -21,5 +21,5 @@ const __llvm_pgo_data *__llvm_pgo_data_begin() { return &DataStart; }
|
|||
const __llvm_pgo_data *__llvm_pgo_data_end() { return &DataEnd; }
|
||||
const char *__llvm_pgo_names_begin() { return &NamesStart; }
|
||||
const char *__llvm_pgo_names_end() { return &NamesEnd; }
|
||||
const uint64_t *__llvm_pgo_counters_begin() { return &CountersStart; }
|
||||
const uint64_t *__llvm_pgo_counters_end() { return &CountersEnd; }
|
||||
uint64_t *__llvm_pgo_counters_begin() { return &CountersStart; }
|
||||
uint64_t *__llvm_pgo_counters_end() { return &CountersEnd; }
|
||||
|
|
|
@ -13,8 +13,8 @@ static const __llvm_pgo_data *DataFirst = NULL;
|
|||
static const __llvm_pgo_data *DataLast = NULL;
|
||||
static const char *NamesFirst = NULL;
|
||||
static const char *NamesLast = NULL;
|
||||
static const uint64_t *CountersFirst = NULL;
|
||||
static const uint64_t *CountersLast = NULL;
|
||||
static uint64_t *CountersFirst = NULL;
|
||||
static uint64_t *CountersLast = NULL;
|
||||
|
||||
/*!
|
||||
* \brief Register an instrumented function.
|
||||
|
@ -55,5 +55,5 @@ const __llvm_pgo_data *__llvm_pgo_data_begin() { return DataFirst; }
|
|||
const __llvm_pgo_data *__llvm_pgo_data_end() { return DataLast; }
|
||||
const char *__llvm_pgo_names_begin() { return NamesFirst; }
|
||||
const char *__llvm_pgo_names_end() { return NamesLast; }
|
||||
const uint64_t *__llvm_pgo_counters_begin() { return CountersFirst; }
|
||||
const uint64_t *__llvm_pgo_counters_end() { return CountersLast; }
|
||||
uint64_t *__llvm_pgo_counters_begin() { return CountersFirst; }
|
||||
uint64_t *__llvm_pgo_counters_end() { return CountersLast; }
|
||||
|
|
Loading…
Reference in New Issue