summaryrefslogtreecommitdiffstats
path: root/runtime/trace.h
diff options
context:
space:
mode:
authorJeff Hao <jeffhao@google.com>2013-08-16 16:27:18 -0700
committerJeff Hao <jeffhao@google.com>2013-08-16 16:57:04 -0700
commit5ce4b178d2483df679e7f718e379305e5d42a300 (patch)
tree509c9e3b79448038e7263c147fdcc3fde7708cc6 /runtime/trace.h
parent212ec8f32919d50a1e1cb7ea4b3b91ca938ae4e6 (diff)
downloadart-5ce4b178d2483df679e7f718e379305e5d42a300.zip
art-5ce4b178d2483df679e7f718e379305e5d42a300.tar.gz
art-5ce4b178d2483df679e7f718e379305e5d42a300.tar.bz2
Clean up sampling tracing.
- Moved maps to fields within thread. - Created temp trace field to lessen amount of traces allocated and freed. Change-Id: I23fe25a85ad2894cc6917f87d4046cdececf0739
Diffstat (limited to 'runtime/trace.h')
-rw-r--r--runtime/trace.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/runtime/trace.h b/runtime/trace.h
index 5733929..9fe2cc6 100644
--- a/runtime/trace.h
+++ b/runtime/trace.h
@@ -83,6 +83,11 @@ class Trace : public instrumentation::InstrumentationListener {
mirror::Throwable* exception_object)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ // Reuse an old stack trace if it exists, otherwise allocate a new one.
+ static std::vector<mirror::ArtMethod*>* AllocStackTrace();
+ // Clear and store an old stack trace for later use.
+ static void FreeStackTrace(std::vector<mirror::ArtMethod*>* stack_trace);
+
~Trace();
private:
@@ -116,11 +121,8 @@ class Trace : public instrumentation::InstrumentationListener {
// Sampling thread, non-zero when sampling.
static pthread_t sampling_pthread_;
- // Maps a thread to its most recent stack trace sample.
- SafeMap<Thread*, std::vector<mirror::ArtMethod*>*> thread_stack_trace_map_;
-
- // Maps a thread to its clock base.
- SafeMap<Thread*, uint64_t> thread_clock_base_map_;
+ // Used to remember an unused stack trace to avoid re-allocation during sampling.
+ static UniquePtr<std::vector<mirror::ArtMethod*> > temp_stack_trace_;
// File to write trace data out to, NULL if direct to ddms.
UniquePtr<File> trace_file_;