blob: 859f523ef0dc9d7c7d8b6bd8873027a86a68fce5 [file] [log] [blame]
Elliott Hughes2faa5f12012-01-30 14:42:07 -08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
jeffhaoe343b762011-12-05 16:36:44 -080016
17#include "trace.h"
18
jeffhaoa9ef3fd2011-12-13 18:33:43 -080019#include <sys/uio.h>
20
Elliott Hughes76160052012-12-12 16:31:20 -080021#include "base/unix_file/fd_file.h"
jeffhaoe343b762011-12-05 16:36:44 -080022#include "class_linker.h"
jeffhaoa9ef3fd2011-12-13 18:33:43 -080023#include "debugger.h"
Ian Rogers4f6ad8a2013-03-18 15:27:28 -070024#include "dex_file-inl.h"
jeffhao725a9572012-11-13 18:20:12 -080025#include "instrumentation.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080026#include "mirror/abstract_method-inl.h"
Ian Rogers4f6ad8a2013-03-18 15:27:28 -070027#include "mirror/class-inl.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080028#include "mirror/dex_cache.h"
29#include "mirror/object_array-inl.h"
Ian Rogers4f6ad8a2013-03-18 15:27:28 -070030#include "mirror/object-inl.h"
Ian Rogersc928de92013-02-27 14:30:44 -080031#if !defined(ART_USE_PORTABLE_COMPILER)
Ian Rogers57b86d42012-03-27 16:05:41 -070032#include "oat/runtime/oat_support_entrypoints.h"
Ian Rogers776ac1f2012-04-13 23:36:36 -070033#endif
jeffhaoa9ef3fd2011-12-13 18:33:43 -080034#include "object_utils.h"
35#include "os.h"
Ian Rogers00f7d0e2012-07-19 15:28:27 -070036#include "scoped_thread_state_change.h"
jeffhaoe343b762011-12-05 16:36:44 -080037#include "thread.h"
Ian Rogers57b86d42012-03-27 16:05:41 -070038#include "thread_list.h"
jeffhao2692b572011-12-16 15:42:28 -080039
40namespace art {
41
Elliott Hughese119a362012-05-22 17:37:06 -070042// File format:
43// header
44// record 0
45// record 1
46// ...
47//
48// Header format:
49// u4 magic ('SLOW')
50// u2 version
51// u2 offset to data
52// u8 start date/time in usec
53// u2 record size in bytes (version >= 2 only)
54// ... padding to 32 bytes
55//
56// Record format v1:
57// u1 thread ID
58// u4 method ID | method action
59// u4 time delta since start, in usec
60//
61// Record format v2:
62// u2 thread ID
63// u4 method ID | method action
64// u4 time delta since start, in usec
65//
66// Record format v3:
67// u2 thread ID
68// u4 method ID | method action
69// u4 time delta since start, in usec
70// u4 wall time since start, in usec (when clock == "dual" only)
71//
72// 32 bits of microseconds is 70 minutes.
73//
74// All values are stored in little-endian order.
75
jeffhaoa9ef3fd2011-12-13 18:33:43 -080076static const uint32_t kTraceMethodActionMask = 0x03; // two bits
77static const char kTraceTokenChar = '*';
78static const uint16_t kTraceHeaderLength = 32;
79static const uint32_t kTraceMagicValue = 0x574f4c53;
80static const uint16_t kTraceVersionSingleClock = 2;
81static const uint16_t kTraceVersionDualClock = 3;
82static const uint16_t kTraceRecordSizeSingleClock = 10; // using v2
83static const uint16_t kTraceRecordSizeDualClock = 14; // using v3 with two timestamps
84
Elliott Hughese119a362012-05-22 17:37:06 -070085static ProfilerClockSource gDefaultTraceClockSource = kProfilerClockSourceDual;
86
jeffhaoa9ef3fd2011-12-13 18:33:43 -080087static inline uint32_t TraceMethodId(uint32_t methodValue) {
88 return (methodValue & ~kTraceMethodActionMask);
89}
Elliott Hughese119a362012-05-22 17:37:06 -070090
jeffhaoa9ef3fd2011-12-13 18:33:43 -080091static inline uint32_t TraceMethodCombine(uint32_t method, uint8_t traceEvent) {
92 return (method | traceEvent);
93}
94
Elliott Hughese119a362012-05-22 17:37:06 -070095void Trace::SetDefaultClockSource(ProfilerClockSource clock_source) {
96 gDefaultTraceClockSource = clock_source;
jeffhaoa9ef3fd2011-12-13 18:33:43 -080097}
98
Elliott Hughese119a362012-05-22 17:37:06 -070099bool Trace::UseThreadCpuClock() {
100#if defined(HAVE_POSIX_CLOCKS)
101 return clock_source_ != kProfilerClockSourceWall;
102#else
103 return false;
104#endif
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800105}
106
Elliott Hughese119a362012-05-22 17:37:06 -0700107bool Trace::UseWallClock() {
108#if defined(HAVE_POSIX_CLOCKS)
109 return clock_source_ != kProfilerClockSourceThreadCpu;
110#else
111 return true;
112#endif
113}
114
115static void MeasureClockOverhead(Trace* trace) {
116 if (trace->UseThreadCpuClock()) {
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800117 ThreadCpuMicroTime();
118 }
Elliott Hughese119a362012-05-22 17:37:06 -0700119 if (trace->UseWallClock()) {
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800120 MicroTime();
121 }
122}
123
Elliott Hughese119a362012-05-22 17:37:06 -0700124static uint32_t GetClockOverhead(Trace* trace) {
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800125 uint64_t start = ThreadCpuMicroTime();
126
127 for (int i = 4000; i > 0; i--) {
Elliott Hughese119a362012-05-22 17:37:06 -0700128 MeasureClockOverhead(trace);
129 MeasureClockOverhead(trace);
130 MeasureClockOverhead(trace);
131 MeasureClockOverhead(trace);
132 MeasureClockOverhead(trace);
133 MeasureClockOverhead(trace);
134 MeasureClockOverhead(trace);
135 MeasureClockOverhead(trace);
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800136 }
137
138 uint64_t elapsed = ThreadCpuMicroTime() - start;
139 return uint32_t (elapsed / 32);
140}
141
Elliott Hughesffb465f2012-03-01 18:46:05 -0800142// TODO: put this somewhere with the big-endian equivalent used by JDWP.
143static void Append2LE(uint8_t* buf, uint16_t val) {
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800144 *buf++ = (uint8_t) val;
145 *buf++ = (uint8_t) (val >> 8);
146}
147
Elliott Hughesffb465f2012-03-01 18:46:05 -0800148// TODO: put this somewhere with the big-endian equivalent used by JDWP.
149static void Append4LE(uint8_t* buf, uint32_t val) {
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800150 *buf++ = (uint8_t) val;
151 *buf++ = (uint8_t) (val >> 8);
152 *buf++ = (uint8_t) (val >> 16);
153 *buf++ = (uint8_t) (val >> 24);
154}
155
Elliott Hughesffb465f2012-03-01 18:46:05 -0800156// TODO: put this somewhere with the big-endian equivalent used by JDWP.
157static void Append8LE(uint8_t* buf, uint64_t val) {
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800158 *buf++ = (uint8_t) val;
159 *buf++ = (uint8_t) (val >> 8);
160 *buf++ = (uint8_t) (val >> 16);
161 *buf++ = (uint8_t) (val >> 24);
162 *buf++ = (uint8_t) (val >> 32);
163 *buf++ = (uint8_t) (val >> 40);
164 *buf++ = (uint8_t) (val >> 48);
165 *buf++ = (uint8_t) (val >> 56);
166}
167
Elliott Hughese119a362012-05-22 17:37:06 -0700168Trace::Trace(File* trace_file, int buffer_size, int flags)
169 : trace_file_(trace_file), buf_(new uint8_t[buffer_size]()), flags_(flags),
170 clock_source_(gDefaultTraceClockSource), overflow_(false),
171 buffer_size_(buffer_size), start_time_(0), trace_version_(0), record_size_(0), cur_offset_(0) {
172}
173
jeffhaoe343b762011-12-05 16:36:44 -0800174void Trace::Start(const char* trace_filename, int trace_fd, int buffer_size, int flags, bool direct_to_ddms) {
jeffhao2692b572011-12-16 15:42:28 -0800175 if (Runtime::Current()->IsMethodTracingActive()) {
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800176 LOG(INFO) << "Trace already in progress, ignoring this request";
jeffhaoe343b762011-12-05 16:36:44 -0800177 return;
178 }
179
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700180 Runtime::Current()->GetThreadList()->SuspendAll();
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800181
jeffhao2692b572011-12-16 15:42:28 -0800182 // Open trace file if not going directly to ddms.
183 File* trace_file = NULL;
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800184 if (!direct_to_ddms) {
185 if (trace_fd < 0) {
jeffhao2692b572011-12-16 15:42:28 -0800186 trace_file = OS::OpenFile(trace_filename, true);
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800187 } else {
Elliott Hughes76160052012-12-12 16:31:20 -0800188 trace_file = new File(trace_fd, "tracefile");
189 trace_file->DisableAutoClose();
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800190 }
jeffhao2692b572011-12-16 15:42:28 -0800191 if (trace_file == NULL) {
jeffhaob5e81852012-03-12 11:15:45 -0700192 PLOG(ERROR) << "Unable to open trace file '" << trace_filename << "'";
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800193 Thread::Current()->ThrowNewException("Ljava/lang/RuntimeException;",
194 StringPrintf("Unable to open trace file '%s'", trace_filename).c_str());
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700195 Runtime::Current()->GetThreadList()->ResumeAll();
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800196 return;
197 }
198 }
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800199
jeffhao2692b572011-12-16 15:42:28 -0800200 // Create Trace object.
jeffhao0791adc2012-04-04 11:14:32 -0700201 Trace* tracer(new Trace(trace_file, buffer_size, flags));
202
203 // Enable count of allocs if specified in the flags.
204 if ((flags && kTraceCountAllocs) != 0) {
205 Runtime::Current()->SetStatsEnabled(true);
206 }
207
jeffhao2692b572011-12-16 15:42:28 -0800208 Runtime::Current()->EnableMethodTracing(tracer);
209 tracer->BeginTracing();
210
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700211 Runtime::Current()->GetThreadList()->ResumeAll();
jeffhao2692b572011-12-16 15:42:28 -0800212}
213
214void Trace::Stop() {
215 if (!Runtime::Current()->IsMethodTracingActive()) {
216 LOG(INFO) << "Trace stop requested, but no trace currently running";
217 return;
218 }
219
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700220 Runtime::Current()->GetThreadList()->SuspendAll();
jeffhao2692b572011-12-16 15:42:28 -0800221
jeffhao725a9572012-11-13 18:20:12 -0800222 Runtime::Current()->GetInstrumentation()->GetTrace()->FinishTracing();
jeffhao2692b572011-12-16 15:42:28 -0800223 Runtime::Current()->DisableMethodTracing();
224
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700225 Runtime::Current()->GetThreadList()->ResumeAll();
jeffhao2692b572011-12-16 15:42:28 -0800226}
227
jeffhaob5e81852012-03-12 11:15:45 -0700228void Trace::Shutdown() {
229 if (!Runtime::Current()->IsMethodTracingActive()) {
230 LOG(INFO) << "Trace shutdown requested, but no trace currently running";
231 return;
232 }
jeffhao725a9572012-11-13 18:20:12 -0800233 Runtime::Current()->GetInstrumentation()->GetTrace()->FinishTracing();
jeffhaob5e81852012-03-12 11:15:45 -0700234 Runtime::Current()->DisableMethodTracing();
235}
236
jeffhao2692b572011-12-16 15:42:28 -0800237void Trace::BeginTracing() {
238 // Set the start time of tracing.
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800239 start_time_ = MicroTime();
240
jeffhao2692b572011-12-16 15:42:28 -0800241 // Set trace version and record size.
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800242 if (UseThreadCpuClock() && UseWallClock()) {
243 trace_version_ = kTraceVersionDualClock;
244 record_size_ = kTraceRecordSizeDualClock;
245 } else {
246 trace_version_ = kTraceVersionSingleClock;
247 record_size_ = kTraceRecordSizeSingleClock;
248 }
249
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800250 // Set up the beginning of the trace.
jeffhao2692b572011-12-16 15:42:28 -0800251 memset(buf_.get(), 0, kTraceHeaderLength);
252 Append4LE(buf_.get(), kTraceMagicValue);
253 Append2LE(buf_.get() + 4, trace_version_);
254 Append2LE(buf_.get() + 6, kTraceHeaderLength);
255 Append8LE(buf_.get() + 8, start_time_);
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800256 if (trace_version_ >= kTraceVersionDualClock) {
jeffhao2692b572011-12-16 15:42:28 -0800257 Append2LE(buf_.get() + 16, record_size_);
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800258 }
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800259
jeffhao2692b572011-12-16 15:42:28 -0800260 // Update current offset.
261 cur_offset_ = kTraceHeaderLength;
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800262
263 // Install all method tracing stubs.
jeffhao725a9572012-11-13 18:20:12 -0800264 Runtime::Current()->GetInstrumentation()->InstallStubs();
jeffhaoe343b762011-12-05 16:36:44 -0800265}
266
jeffhao2692b572011-12-16 15:42:28 -0800267void Trace::FinishTracing() {
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800268 // Uninstall all method tracing stubs.
jeffhao725a9572012-11-13 18:20:12 -0800269 Runtime::Current()->GetInstrumentation()->UninstallStubs();
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800270
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800271 // Compute elapsed time.
272 uint64_t elapsed = MicroTime() - start_time_;
273
274 size_t final_offset = cur_offset_;
Elliott Hughese119a362012-05-22 17:37:06 -0700275 uint32_t clock_overhead = GetClockOverhead(this);
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800276
jeffhao0791adc2012-04-04 11:14:32 -0700277 if ((flags_ & kTraceCountAllocs) != 0) {
278 Runtime::Current()->SetStatsEnabled(false);
279 }
280
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800281 GetVisitedMethods(final_offset);
282
283 std::ostringstream os;
284
285 os << StringPrintf("%cversion\n", kTraceTokenChar);
286 os << StringPrintf("%d\n", trace_version_);
287 os << StringPrintf("data-file-overflow=%s\n", overflow_ ? "true" : "false");
288 if (UseThreadCpuClock()) {
289 if (UseWallClock()) {
290 os << StringPrintf("clock=dual\n");
291 } else {
292 os << StringPrintf("clock=thread-cpu\n");
293 }
294 } else {
295 os << StringPrintf("clock=wall\n");
296 }
297 os << StringPrintf("elapsed-time-usec=%llu\n", elapsed);
Elliott Hughesad6c9c32012-01-19 17:39:12 -0800298 os << StringPrintf("num-method-calls=%zd\n", (final_offset - kTraceHeaderLength) / record_size_);
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800299 os << StringPrintf("clock-call-overhead-nsec=%d\n", clock_overhead);
300 os << StringPrintf("vm=art\n");
jeffhao0791adc2012-04-04 11:14:32 -0700301 if ((flags_ & kTraceCountAllocs) != 0) {
302 os << StringPrintf("alloc-count=%d\n", Runtime::Current()->GetStat(KIND_ALLOCATED_OBJECTS));
303 os << StringPrintf("alloc-size=%d\n", Runtime::Current()->GetStat(KIND_ALLOCATED_BYTES));
304 os << StringPrintf("gc-count=%d\n", Runtime::Current()->GetStat(KIND_GC_INVOCATIONS));
305 }
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800306 os << StringPrintf("%cthreads\n", kTraceTokenChar);
307 DumpThreadList(os);
308 os << StringPrintf("%cmethods\n", kTraceTokenChar);
309 DumpMethodList(os);
310 os << StringPrintf("%cend\n", kTraceTokenChar);
311
312 std::string header(os.str());
jeffhao2692b572011-12-16 15:42:28 -0800313 if (trace_file_.get() == NULL) {
Elliott Hughes7b9d9962012-04-20 18:48:18 -0700314 iovec iov[2];
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800315 iov[0].iov_base = reinterpret_cast<void*>(const_cast<char*>(header.c_str()));
316 iov[0].iov_len = header.length();
jeffhao2692b572011-12-16 15:42:28 -0800317 iov[1].iov_base = buf_.get();
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800318 iov[1].iov_len = final_offset;
319 Dbg::DdmSendChunkV(CHUNK_TYPE("MPSE"), iov, 2);
320 } else {
321 if (!trace_file_->WriteFully(header.c_str(), header.length()) ||
jeffhao2692b572011-12-16 15:42:28 -0800322 !trace_file_->WriteFully(buf_.get(), final_offset)) {
Elliott Hughes7b9d9962012-04-20 18:48:18 -0700323 std::string detail(StringPrintf("Trace data write failed: %s", strerror(errno)));
324 PLOG(ERROR) << detail;
325 Thread::Current()->ThrowNewException("Ljava/lang/RuntimeException;", detail.c_str());
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800326 }
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800327 }
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800328}
329
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800330void Trace::LogMethodTraceEvent(Thread* self, const mirror::AbstractMethod* method,
331 Trace::TraceEvent event) {
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800332 if (thread_clock_base_map_.find(self) == thread_clock_base_map_.end()) {
333 uint64_t time = ThreadCpuMicroTime();
Elliott Hughesa0e18062012-04-13 15:59:59 -0700334 thread_clock_base_map_.Put(self, time);
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800335 }
336
337 // Advance cur_offset_ atomically.
338 int32_t new_offset;
339 int32_t old_offset;
340 do {
341 old_offset = cur_offset_;
342 new_offset = old_offset + record_size_;
343 if (new_offset > buffer_size_) {
344 overflow_ = true;
345 return;
346 }
347 } while (android_atomic_release_cas(old_offset, new_offset, &cur_offset_) != 0);
348
349 uint32_t method_value = TraceMethodCombine(reinterpret_cast<uint32_t>(method), event);
350
351 // Write data
jeffhao2692b572011-12-16 15:42:28 -0800352 uint8_t* ptr = buf_.get() + old_offset;
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800353 Append2LE(ptr, self->GetTid());
354 Append4LE(ptr + 2, method_value);
355 ptr += 6;
356
357 if (UseThreadCpuClock()) {
358 uint64_t thread_clock_base = thread_clock_base_map_.find(self)->second;
359 uint32_t thread_clock_diff = ThreadCpuMicroTime() - thread_clock_base;
360 Append4LE(ptr, thread_clock_diff);
361 ptr += 4;
362 }
363
364 if (UseWallClock()) {
365 uint32_t wall_clock_diff = MicroTime() - start_time_;
366 Append4LE(ptr, wall_clock_diff);
367 }
368}
369
370void Trace::GetVisitedMethods(size_t end_offset) {
jeffhao2692b572011-12-16 15:42:28 -0800371 uint8_t* ptr = buf_.get() + kTraceHeaderLength;
372 uint8_t* end = buf_.get() + end_offset;
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800373
374 while (ptr < end) {
375 uint32_t method_value = ptr[2] | (ptr[3] << 8) | (ptr[4] << 16) | (ptr[5] << 24);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800376 mirror::AbstractMethod* method =
377 reinterpret_cast<mirror::AbstractMethod*>(TraceMethodId(method_value));
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800378 visited_methods_.insert(method);
379 ptr += record_size_;
380 }
381}
382
383void Trace::DumpMethodList(std::ostream& os) {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800384 typedef std::set<const mirror::AbstractMethod*>::const_iterator It; // TODO: C++0x auto
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800385 for (It it = visited_methods_.begin(); it != visited_methods_.end(); ++it) {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800386 const mirror::AbstractMethod* method = *it;
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800387 MethodHelper mh(method);
Ian Rogers0399dde2012-06-06 17:09:28 -0700388 os << StringPrintf("%p\t%s\t%s\t%s\t%s\n", method,
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800389 PrettyDescriptor(mh.GetDeclaringClassDescriptor()).c_str(), mh.GetName(),
Ian Rogers0399dde2012-06-06 17:09:28 -0700390 mh.GetSignature().c_str(), mh.GetDeclaringClassSourceFile());
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800391 }
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800392}
393
394static void DumpThread(Thread* t, void* arg) {
Elliott Hughesffb465f2012-03-01 18:46:05 -0800395 std::ostream& os = *reinterpret_cast<std::ostream*>(arg);
396 std::string name;
397 t->GetThreadName(name);
398 os << t->GetTid() << "\t" << name << "\n";
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800399}
400
401void Trace::DumpThreadList(std::ostream& os) {
Ian Rogers81d425b2012-09-27 16:03:43 -0700402 Thread* self = Thread::Current();
403 Locks::thread_list_lock_->AssertNotHeld(self);
404 MutexLock mu(self, *Locks::thread_list_lock_);
jeffhaoa9ef3fd2011-12-13 18:33:43 -0800405 Runtime::Current()->GetThreadList()->ForEach(DumpThread, &os);
jeffhaoe343b762011-12-05 16:36:44 -0800406}
407
jeffhaoe343b762011-12-05 16:36:44 -0800408} // namespace art