aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/build/perftools.c7
-rw-r--r--test/core/util/grpc_profiler.c9
2 files changed, 16 insertions, 0 deletions
diff --git a/test/build/perftools.c b/test/build/perftools.c
new file mode 100644
index 0000000000..03548b4c7e
--- /dev/null
+++ b/test/build/perftools.c
@@ -0,0 +1,7 @@
+#include <gperftools/profiler.h>
+
+int main() {
+ ProfilerStart("/dev/null");
+ ProfilerStop();
+ return 0;
+}
diff --git a/test/core/util/grpc_profiler.c b/test/core/util/grpc_profiler.c
index 340b2d53b9..489d34396a 100644
--- a/test/core/util/grpc_profiler.c
+++ b/test/core/util/grpc_profiler.c
@@ -33,6 +33,15 @@
#include "test/core/util/grpc_profiler.h"
+#if GRPC_HAVE_PERFTOOLS
+#include <gperftools/profiler.h>
+
+void grpc_profiler_start(const char *filename) { ProfilerStart(filename); }
+
+void grpc_profiler_stop() { ProfilerStop(); }
+#else
+
void grpc_profiler_start(const char *filename) {}
void grpc_profiler_stop(void) {}
+#endif