diff options
author | dmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-11 11:06:58 +0000 |
---|---|---|
committer | dmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-11 11:06:58 +0000 |
commit | 6b60d65c6baa3c8dd20d6d901093516046492d66 (patch) | |
tree | 6f64b93557960d52c595472d07676df4774855e8 /third_party | |
parent | d535787dfdf8bc1454cb1fef49b6b3861949cb22 (diff) | |
download | chromium_src-6b60d65c6baa3c8dd20d6d901093516046492d66.zip chromium_src-6b60d65c6baa3c8dd20d6d901093516046492d66.tar.gz chromium_src-6b60d65c6baa3c8dd20d6d901093516046492d66.tar.bz2 |
Add RunID in deep-heap-profile which roughly discriminate each process execution.
RunID is used to identify and descriminate each process execution. It doesn't
need so strict universal uniqueness.
It is just an identifier. The format may change in future.
BUG=None
Review URL: https://chromiumcodereview.appspot.com/18386009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211066 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/tcmalloc/chromium/src/deep-heap-profile.cc | 18 | ||||
-rw-r--r-- | third_party/tcmalloc/chromium/src/deep-heap-profile.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/third_party/tcmalloc/chromium/src/deep-heap-profile.cc b/third_party/tcmalloc/chromium/src/deep-heap-profile.cc index d1ce165..efbf423 100644 --- a/third_party/tcmalloc/chromium/src/deep-heap-profile.cc +++ b/third_party/tcmalloc/chromium/src/deep-heap-profile.cc @@ -289,6 +289,8 @@ DeepHeapProfile::DeepHeapProfile(HeapProfileTable* heap_profile, reinterpret_cast<char*>(heap_profile_->alloc_(prefix_length + 1)); memcpy(filename_prefix_, prefix, prefix_length); filename_prefix_[prefix_length] = '\0'; + + strncpy(run_id_, "undetermined-run-id", sizeof(run_id_)); } DeepHeapProfile::~DeepHeapProfile() { @@ -316,8 +318,20 @@ void DeepHeapProfile::DumpOrderedProfile(const char* reason, // Re-open files in /proc/pid/ if the process is newly forked one. if (most_recent_pid_ != getpid()) { + char hostname[64]; + if (0 == gethostname(hostname, sizeof(hostname))) { + char* dot = strchr(hostname, '.'); + if (dot != NULL) + *dot = '\0'; + } else { + strcpy(hostname, "unknown"); + } + most_recent_pid_ = getpid(); + snprintf(run_id_, sizeof(run_id_), "%s-linux-%d-%lu", + hostname, most_recent_pid_, time(NULL)); + memory_residence_info_getter_->Initialize(); deep_table_.ResetIsLogged(); @@ -354,6 +368,10 @@ void DeepHeapProfile::DumpOrderedProfile(const char* reason, AppendCommandLine(&buffer); + buffer.AppendString("RunID: ", 0); + buffer.AppendString(run_id_, 0); + buffer.AppendChar('\n'); + buffer.AppendString("PageSize: ", 0); buffer.AppendInt(getpagesize(), 0, 0); buffer.AppendChar('\n'); diff --git a/third_party/tcmalloc/chromium/src/deep-heap-profile.h b/third_party/tcmalloc/chromium/src/deep-heap-profile.h index a3fcc4b..c2ee897 100644 --- a/third_party/tcmalloc/chromium/src/deep-heap-profile.h +++ b/third_party/tcmalloc/chromium/src/deep-heap-profile.h @@ -375,6 +375,7 @@ class DeepHeapProfile { GlobalStats stats_; // Stats about total memory. int dump_count_; // The number of dumps. char* filename_prefix_; // Output file prefix. + char run_id_[128]; DeepBucketTable deep_table_; |