summaryrefslogtreecommitdiffstats
path: root/third_party/tcmalloc
diff options
context:
space:
mode:
authordmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-21 12:30:28 +0000
committerdmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-21 12:30:28 +0000
commitbac070f8f5e94bfa0d3e823b4796d70a13001ce5 (patch)
tree4fbea23e7eca35a7ea975dee235dde43aaf0322b /third_party/tcmalloc
parentbf4bb55285bdb1429a1fa6a0e42d1b46a7a10c91 (diff)
downloadchromium_src-bac070f8f5e94bfa0d3e823b4796d70a13001ce5.zip
chromium_src-bac070f8f5e94bfa0d3e823b4796d70a13001ce5.tar.gz
chromium_src-bac070f8f5e94bfa0d3e823b4796d70a13001ce5.tar.bz2
Use UNIX time (seconds since January 1, 1970, 00:00:00) in deep-heap-profile.cc.
BUG=None TBR=willchan@chromium.org Review URL: https://codereview.chromium.org/15250007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201294 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/tcmalloc')
-rw-r--r--third_party/tcmalloc/chromium/src/deep-heap-profile.cc31
1 files changed, 3 insertions, 28 deletions
diff --git a/third_party/tcmalloc/chromium/src/deep-heap-profile.cc b/third_party/tcmalloc/chromium/src/deep-heap-profile.cc
index 4c81d62..f89d8ce 100644
--- a/third_party/tcmalloc/chromium/src/deep-heap-profile.cc
+++ b/third_party/tcmalloc/chromium/src/deep-heap-profile.cc
@@ -13,9 +13,6 @@
#include <algorithm>
#include <fcntl.h>
#include <sys/stat.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
#include <sys/types.h>
#include <time.h>
#ifdef HAVE_UNISTD_H
@@ -240,17 +237,9 @@ int DeepHeapProfile::FillOrderedProfile(char raw_buffer[], int buffer_size) {
int64 starting_cycles = CycleClock::Now();
#endif
- // Get the time before starting snapshot. gettimeofday() and localtime_r()
- // acquire the timezone lock which may invoke malloc.
- struct tm local_time;
-#ifdef HAVE_SYS_TIME_H
- struct timeval time_value;
- gettimeofday(&time_value, NULL);
- localtime_r(&time_value.tv_sec, &local_time);
-#else
+ // Get the time before starting snapshot.
+ // TODO(dmikurube): Consider gettimeofday if available.
time_t time_value = time(NULL);
- localtime_r(&time_value, &local_time);
-#endif
++dump_count_;
@@ -283,21 +272,7 @@ int DeepHeapProfile::FillOrderedProfile(char raw_buffer[], int buffer_size) {
buffer.AppendString(kMetaInformationHeader, 0);
buffer.AppendString("Time: ", 0);
- buffer.AppendInt(local_time.tm_year + 1900, 4, true);
- buffer.AppendChar('/');
- buffer.AppendInt(local_time.tm_mon + 1, 2, true);
- buffer.AppendChar('/');
- buffer.AppendInt(local_time.tm_mday, 2, true);
- buffer.AppendChar(' ');
- buffer.AppendInt(local_time.tm_hour, 2, true);
- buffer.AppendChar(':');
- buffer.AppendInt(local_time.tm_min, 2, true);
- buffer.AppendChar(':');
- buffer.AppendInt(local_time.tm_sec, 2, true);
-#ifdef HAVE_SYS_TIME_H
- buffer.AppendChar('.');
- buffer.AppendInt(static_cast<int>(time_value.tv_usec / 1000), 3, true);
-#endif
+ buffer.AppendUnsignedLong(time_value, 0);
buffer.AppendChar('\n');
// Fill buffer with the global stats.