Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: tools/cygprofile/mergetraces.py

Issue 272393004: Make cygprofile use clock_gettime() instead of gettimeofday(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Egor's comment Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/cygprofile/cygprofile.cc ('k') | tools/cygprofile/symbolize.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/cygprofile/mergetraces.py
diff --git a/tools/cygprofile/mergetraces.py b/tools/cygprofile/mergetraces.py
index 5d85920beb6d3737d0d004c849616f1d1f660074..1c7627a8dff507408a3bcee8af0a030a45d8f6c3 100755
--- a/tools/cygprofile/mergetraces.py
+++ b/tools/cygprofile/mergetraces.py
@@ -26,7 +26,7 @@ def ParseLogLines(lines):
Below is an example of a small log file:
5086e000-52e92000 r-xp 00000000 b3:02 51276 libchromeview.so
- secs msecs pid:threadid func
+ secs usecs pid:threadid func
START
1314897086 795828 3587:1074648168 0x509e105c
1314897086 795874 3587:1074648168 0x509e0eb4
@@ -78,18 +78,18 @@ def CheckTimestamps(calls):
"""
index = 0
last_timestamp_secs = -1
- last_timestamp_ms = -1
+ last_timestamp_us = -1
while (index < len (calls)):
timestamp_secs = int (calls[index][0])
- timestamp_ms = int (calls[index][1])
- timestamp = (timestamp_secs * 1000000) + timestamp_ms
- last_timestamp = (last_timestamp_secs * 1000000) + last_timestamp_ms
+ timestamp_us = int (calls[index][1])
+ timestamp = (timestamp_secs * 1000000) + timestamp_us
+ last_timestamp = (last_timestamp_secs * 1000000) + last_timestamp_us
if (timestamp < last_timestamp):
- sys.stderr.write("WARNING: last_timestamp: " + str(last_timestamp_secs)
- + " " + str(last_timestamp_ms) + " timestamp: "
- + str(timestamp_secs) + " " + str(timestamp_ms) + "\n")
+ raise Exception("last_timestamp: " + str(last_timestamp_secs)
+ + " " + str(last_timestamp_us) + " timestamp: "
+ + str(timestamp_secs) + " " + str(timestamp_us) + "\n")
last_timestamp_secs = timestamp_secs
- last_timestamp_ms = timestamp_ms
+ last_timestamp_us = timestamp_us
index = index + 1
def Convert (call_lines, startAddr, endAddr):
@@ -100,19 +100,19 @@ def Convert (call_lines, startAddr, endAddr):
address in shared library.
Returns:
- list of calls as tuples (sec, msec, pid:tid, callee)
+ list of calls as tuples (sec, usec, pid:tid, callee)
"""
converted_calls = []
call_addresses = []
for fields in call_lines:
secs = int (fields[0])
- msecs = int (fields[1])
+ usecs = int (fields[1])
callee = int (fields[3], 16)
# print ("callee: " + hex (callee) + " start: " + hex (startAddr) + " end: "
# + hex (endAddr))
if (callee >= startAddr and callee < endAddr
and (not callee in call_addresses)):
- converted_calls.append((secs, msecs, fields[2], (callee - startAddr)))
+ converted_calls.append((secs, usecs, fields[2], (callee - startAddr)))
call_addresses.append(callee)
return converted_calls
@@ -177,7 +177,7 @@ def main():
merged_trace.sort(key=Timestamp)
print "0-ffffffff r-xp 00000000 xx:00 00000 ./"
- print "secs\tmsecs\tpid:threadid\tfunc"
+ print "secs\tusecs\tpid:threadid\tfunc"
for call in merged_trace:
print (str(call[0]) + "\t" + str(call[1]) + "\t" + call[2] + "\t" +
hex(call[3]))
« no previous file with comments | « tools/cygprofile/cygprofile.cc ('k') | tools/cygprofile/symbolize.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698