summaryrefslogtreecommitdiffstats
path: root/libc/private
diff options
context:
space:
mode:
authorBrigid Smith <brigidsmith@google.com>2014-07-21 15:38:06 -0700
committerBrigid Smith <brigidsmith@google.com>2014-07-28 19:38:08 -0700
commita406ee6d5f616192e9a13afad6ac6a9969814fc1 (patch)
treebc9d1575ddacb246d49109367b6151732fbfe19e /libc/private
parent337c0cefdc4667143a1f4f2c30113b452c5d188f (diff)
downloadbionic-a406ee6d5f616192e9a13afad6ac6a9969814fc1.zip
bionic-a406ee6d5f616192e9a13afad6ac6a9969814fc1.tar.gz
bionic-a406ee6d5f616192e9a13afad6ac6a9969814fc1.tar.bz2
Added a bionic systrace class and tracing to pthread_mutex.cpp.
bionic_systrace.h contains an implementation of tracing that can be used with systrace.py and its associated viewer. pthread_mutex now uses this tracing to track pthread_mutex contention, which can be enabled by using the "bionic" command line option to systrace. Bug: 15116468 Change-Id: I30ed5b377c91ca4c36568a0e647ddf95d4e4a61a
Diffstat (limited to 'libc/private')
-rw-r--r--libc/private/bionic_systrace.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/libc/private/bionic_systrace.h b/libc/private/bionic_systrace.h
new file mode 100644
index 0000000..ad9ff7f
--- /dev/null
+++ b/libc/private/bionic_systrace.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIONIC_SYSTRACE_H
+#define BIONIC_SYSTRACE_H
+
+#include "bionic_macros.h"
+
+// Tracing class for bionic. To begin a trace at a specified point:
+// ScopedTrace("Trace message");
+// The trace will end when the contructor goes out of scope.
+
+class ScopedTrace {
+ public:
+ explicit ScopedTrace(const char* message);
+ ~ScopedTrace();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ScopedTrace);
+};
+
+#endif