summaryrefslogtreecommitdiffstats
path: root/tools/cygprofile/cygprofile.cc
diff options
context:
space:
mode:
authorpliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-13 14:06:07 +0000
committerpliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-13 14:06:07 +0000
commit8f3215e30b1223866710145d05fe29ba5863a34b (patch)
treeef5e20f40dcac785c222007180039f431acdf731 /tools/cygprofile/cygprofile.cc
parent723127ce19134c3d17b9a66e463f0581411225c5 (diff)
downloadchromium_src-8f3215e30b1223866710145d05fe29ba5863a34b.zip
chromium_src-8f3215e30b1223866710145d05fe29ba5863a34b.tar.gz
chromium_src-8f3215e30b1223866710145d05fe29ba5863a34b.tar.bz2
Make cygprofile use clock_gettime() instead of gettimeofday().
Some of the generated orderfiles looked suspicious. I could observe that one of them had the renderer PID show up before the browser one. The mergetraces.py file was also occasionally complaining about unsorted timestamps. There are not many situations where gettimeofday() should be used instead of clock_gettime(). The former is not monotonic in particular. The original code also had the issue that it was using both gettimeofday() and time(). This also replaces the occurrences of 'ms(ec)' with 'us(ec)' to make it clear that microseconds are used as opposed to milliseconds. BUG=372323 Review URL: https://codereview.chromium.org/272393004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270090 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/cygprofile/cygprofile.cc')
-rw-r--r--tools/cygprofile/cygprofile.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/cygprofile/cygprofile.cc b/tools/cygprofile/cygprofile.cc
index 2086bea..980fa9e 100644
--- a/tools/cygprofile/cygprofile.cc
+++ b/tools/cygprofile/cygprofile.cc
@@ -208,7 +208,7 @@ CygCommon::CygCommon() {
}
}
mapsfile.close();
- header_line_.append("\nsecs\tmsecs\tpid:threadid\tfunc\n");
+ header_line_.append("\nsecs\tusecs\tpid:threadid\tfunc\n");
}
void CygTlsLog::LogEnter(void* this_fn) {
@@ -222,9 +222,9 @@ void CygTlsLog::LogEnter(void* this_fn) {
base::AutoLock lock(log_mutex_);
if (buf_.capacity() < kBufMaxSize)
buf_.reserve(kBufMaxSize);
- struct timeval timestamp;
- gettimeofday(&timestamp, NULL);
- buf_.push_back(CygLogEntry(time(NULL), timestamp.tv_usec,
+ struct timespec timestamp;
+ clock_gettime(CLOCK_MONOTONIC, &timestamp);
+ buf_.push_back(CygLogEntry(timestamp.tv_sec, timestamp.tv_nsec / 1000,
getpid(), pthread_self(), this_fn));
if (buf_.size() == kBufMaxSize) {
FlushLog();