Skip to content

Commit 651437f

Browse files
committed
[XRay] Remove use of deprecated options
In D51606 we deleted the FDR options struct, but forgot to remove those from the test suite benchmarks. llvm-svn: 342426
1 parent a086e60 commit 651437f

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

MicroBenchmarks/XRay/FDRMode/fdrmode-bench.cc

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- fdrmode-bench.cc - XRay Instrumentation Benchmarks ------------------===//
1+
//===- fdrmode-bench.cc - XRay Instrumentation Benchmarks -----------------===//
22
//
33
// The LLVM Compiler Infrastructure
44
//
@@ -26,14 +26,13 @@ namespace {
2626
// stores performed on this variable.
2727
volatile int val = 0;
2828

29-
__xray::FDRLoggingOptions Options;
30-
3129
} // namespace
3230

3331
// We define a multi-threaded benchmark which measures the overall costs
3432
// introduced by the XRay handlers upstream. This will exercise a tight loop
3533
// calling a single function that practically does nothing.
36-
[[clang::xray_always_instrument]] __attribute__((noinline)) __attribute__((weak)) int
34+
[[clang::xray_always_instrument]] __attribute__((noinline))
35+
__attribute__((weak)) int
3736
EmptyFunction() {
3837
return 0;
3938
}
@@ -45,11 +44,14 @@ volatile bool log_initialized = false;
4544
[[clang::xray_never_instrument]] void SetUpXRayFDRMultiThreaded(
4645
benchmark::State& state) {
4746
if (!log_initialized) {
48-
Options.ReportErrors = true;
49-
Options.Fd = open("/dev/null", O_WRONLY);
50-
assert((Options.Fd != -1) && "Cannot open /dev/null!");
51-
__xray_log_init(getpagesize(), 1 << 16, &Options,
52-
sizeof(__xray::FDRLoggingOptions));
47+
if (__xray_log_select_mode("xray-fdr") !=
48+
XRayLogRegisterStatus::XRAY_REGISTRATION_OK)
49+
std::abort();
50+
51+
std::string flags = "no_file_flush=true:buffer_size=";
52+
flags += std::to_string(getpagesize()) + ":buffer_max=";
53+
flags += std::to_string(1 << 16);
54+
__xray_log_init_mode("xray-fdr", flags.c_str());
5355
__xray_remove_customevent_handler();
5456
__xray_patch();
5557
log_initialized = true;
@@ -67,7 +69,7 @@ volatile bool log_initialized = false;
6769
}
6870

6971
[[clang::xray_never_instrument]] static void BM_XRayFDRMultiThreaded(
70-
benchmark::State& state) {
72+
benchmark::State& state) {
7173
if (state.thread_index == 0) {
7274
SetUpXRayFDRMultiThreaded(state);
7375
}
@@ -80,7 +82,6 @@ volatile bool log_initialized = false;
8082
}
8183
}
8284

83-
BENCHMARK(BM_XRayFDRMultiThreaded)
84-
->ThreadRange(1, 32); // Number of threads
85+
BENCHMARK(BM_XRayFDRMultiThreaded)->ThreadRange(1, 32); // Number of threads
8586

8687
BENCHMARK_MAIN();

0 commit comments

Comments
 (0)