| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/heap_profiler.h" | 5 #include "vm/heap_profiler.h" |
| 6 | 6 |
| 7 #include "vm/dart_api_state.h" | 7 #include "vm/dart_api_state.h" |
| 8 #include "vm/object.h" | 8 #include "vm/object.h" |
| 9 #include "vm/raw_object.h" | 9 #include "vm/raw_object.h" |
| 10 #include "vm/stack_frame.h" | 10 #include "vm/stack_frame.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 // [u1]* - format name | 329 // [u1]* - format name |
| 330 // u4 - size of identifiers | 330 // u4 - size of identifiers |
| 331 // u4 - high word of number of milliseconds since 0:00 GMT, 1/1/70 | 331 // u4 - high word of number of milliseconds since 0:00 GMT, 1/1/70 |
| 332 // u4 - low word of number of milliseconds since 0:00 GMT, 1/1/70 | 332 // u4 - low word of number of milliseconds since 0:00 GMT, 1/1/70 |
| 333 void HeapProfiler::WriteHeader() { | 333 void HeapProfiler::WriteHeader() { |
| 334 const char magic[] = "JAVA PROFILE 1.0.1"; | 334 const char magic[] = "JAVA PROFILE 1.0.1"; |
| 335 Write(magic, sizeof(magic)); | 335 Write(magic, sizeof(magic)); |
| 336 uint32_t size = htonl(kObjectIdSize); | 336 uint32_t size = htonl(kObjectIdSize); |
| 337 Write(&size, sizeof(size)); | 337 Write(&size, sizeof(size)); |
| 338 uint64_t milliseconds = OS::GetCurrentTimeMillis(); | 338 uint64_t milliseconds = OS::GetCurrentTimeMillis(); |
| 339 uint32_t hi = htonl((uint32_t)((milliseconds >> 32) & 0x00000000FFFFFFFF)); | 339 uint32_t hi = htonl( |
| 340 static_cast<uint32_t>((milliseconds >> 32) & 0x00000000FFFFFFFF)); |
| 340 Write(&hi, sizeof(hi)); | 341 Write(&hi, sizeof(hi)); |
| 341 uint32_t lo = htonl((uint32_t)(milliseconds & 0x00000000FFFFFFFF)); | 342 uint32_t lo = htonl( |
| 343 static_cast<uint32_t>(milliseconds & 0x00000000FFFFFFFF)); |
| 342 Write(&lo, sizeof(lo)); | 344 Write(&lo, sizeof(lo)); |
| 343 } | 345 } |
| 344 | 346 |
| 345 | 347 |
| 346 // Record | 348 // Record |
| 347 // | 349 // |
| 348 // Format: | 350 // Format: |
| 349 // u1 - TAG: denoting the type of the record | 351 // u1 - TAG: denoting the type of the record |
| 350 // u4 - TIME: number of microseconds since the time stamp in the header | 352 // u4 - TIME: number of microseconds since the time stamp in the header |
| 351 // u4 - LENGTH: number of bytes that follow this u4 field and belong | 353 // u4 - LENGTH: number of bytes that follow this u4 field and belong |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 RawObject* raw_obj = handle->raw(); | 809 RawObject* raw_obj = handle->raw(); |
| 808 visitor_->VisitPointer(&raw_obj); | 810 visitor_->VisitPointer(&raw_obj); |
| 809 } | 811 } |
| 810 | 812 |
| 811 | 813 |
| 812 void HeapProfilerObjectVisitor::VisitObject(RawObject* raw_obj) { | 814 void HeapProfilerObjectVisitor::VisitObject(RawObject* raw_obj) { |
| 813 profiler_->WriteObject(raw_obj); | 815 profiler_->WriteObject(raw_obj); |
| 814 } | 816 } |
| 815 | 817 |
| 816 } // namespace dart | 818 } // namespace dart |
| OLD | NEW |