OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // --- | 5 // --- |
6 // Author: Sainbayar Sukhbaatar | 6 // Author: Sainbayar Sukhbaatar |
7 // Dai Mikurube | 7 // Dai Mikurube |
8 // | 8 // |
9 | 9 |
10 #include "deep-heap-profile.h" | 10 #include "deep-heap-profile.h" |
11 | 11 |
12 #ifdef DEEP_HEAP_PROFILE | 12 #ifdef USE_DEEP_HEAP_PROFILE |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <fcntl.h> | 14 #include <fcntl.h> |
15 #include <sys/stat.h> | 15 #include <sys/stat.h> |
16 #include <sys/types.h> | 16 #include <sys/types.h> |
17 #ifdef HAVE_UNISTD_H | 17 #ifdef HAVE_UNISTD_H |
18 #include <unistd.h> // for getpagesize and getpid | 18 #include <unistd.h> // for getpagesize and getpid |
19 #endif // HAVE_UNISTD_H | 19 #endif // HAVE_UNISTD_H |
20 | 20 |
21 #include "base/cycleclock.h" | 21 #include "base/cycleclock.h" |
22 #include "base/sysinfo.h" | 22 #include "base/sysinfo.h" |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 RAW_DCHECK(fd != kIllegalRawFD, ""); | 905 RAW_DCHECK(fd != kIllegalRawFD, ""); |
906 | 906 |
907 int length; | 907 int length; |
908 bool wrote_all; | 908 bool wrote_all; |
909 length = tcmalloc::FillProcSelfMaps(raw_buffer, buffer_size, &wrote_all); | 909 length = tcmalloc::FillProcSelfMaps(raw_buffer, buffer_size, &wrote_all); |
910 RAW_DCHECK(wrote_all, ""); | 910 RAW_DCHECK(wrote_all, ""); |
911 RAW_DCHECK(length <= buffer_size, ""); | 911 RAW_DCHECK(length <= buffer_size, ""); |
912 RawWrite(fd, raw_buffer, length); | 912 RawWrite(fd, raw_buffer, length); |
913 RawClose(fd); | 913 RawClose(fd); |
914 } | 914 } |
915 #else // DEEP_HEAP_PROFILE | 915 #else // USE_DEEP_HEAP_PROFILE |
916 | 916 |
917 DeepHeapProfile::DeepHeapProfile(HeapProfileTable* heap_profile, | 917 DeepHeapProfile::DeepHeapProfile(HeapProfileTable* heap_profile, |
918 const char* prefix) | 918 const char* prefix) |
919 : heap_profile_(heap_profile) { | 919 : heap_profile_(heap_profile) { |
920 } | 920 } |
921 | 921 |
922 DeepHeapProfile::~DeepHeapProfile() { | 922 DeepHeapProfile::~DeepHeapProfile() { |
923 } | 923 } |
924 | 924 |
925 int DeepHeapProfile::FillOrderedProfile(char raw_buffer[], int buffer_size) { | 925 int DeepHeapProfile::FillOrderedProfile(char raw_buffer[], int buffer_size) { |
926 return heap_profile_->FillOrderedProfile(raw_buffer, buffer_size); | 926 return heap_profile_->FillOrderedProfile(raw_buffer, buffer_size); |
927 } | 927 } |
928 | 928 |
929 #endif // DEEP_HEAP_PROFILE | 929 #endif // USE_DEEP_HEAP_PROFILE |
OLD | NEW |