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

Unified Diff: tools/ll_prof.py

Issue 1796863002: Remove snapshot log parsing and option from tools. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase on master. Created 4 years, 8 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/gyp/v8.gyp ('k') | tools/profviz/worker.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/ll_prof.py
diff --git a/tools/ll_prof.py b/tools/ll_prof.py
index 5fd90cb5c2aa044139dd09e88d3fe30e757b0e54..6d04ab8d73e20ef41b9900f070c9dee4189f9bc7 100755
--- a/tools/ll_prof.py
+++ b/tools/ll_prof.py
@@ -66,20 +66,20 @@ We have a convenience script that handles all of the above for you:
Examples:
# Print flat profile with annotated disassembly for the 10 top
- # symbols. Use default log names and include the snapshot log.
- $ %prog --snapshot --disasm-top=10
+ # symbols. Use default log names.
+ $ %prog --disasm-top=10
# Print flat profile with annotated disassembly for all used symbols.
# Use default log names and include kernel symbols into analysis.
$ %prog --disasm-all --kernel
# Print flat profile. Use custom log names.
- $ %prog --log=foo.log --snapshot-log=snap-foo.log --trace=foo.data --snapshot
+ $ %prog --log=foo.log --trace=foo.data
"""
JS_ORIGIN = "js"
-JS_SNAPSHOT_ORIGIN = "js-snapshot"
+
class Code(object):
"""Code object."""
@@ -199,12 +199,8 @@ class Code(object):
self.origin)
def _GetDisasmLines(self, arch, options):
- if self.origin == JS_ORIGIN or self.origin == JS_SNAPSHOT_ORIGIN:
- inplace = False
- filename = options.log + ".ll"
- else:
- inplace = True
- filename = self.origin
+ inplace = True
+ filename = self.origin
return disasm.GetDisasmLines(filename,
self.origin_offset,
self.end_address - self.start_address,
@@ -328,30 +324,6 @@ class CodeInfo(object):
self.header_size = header_size
-class SnapshotLogReader(object):
- """V8 snapshot log reader."""
-
- _SNAPSHOT_CODE_NAME_RE = re.compile(
- r"snapshot-code-name,(\d+),\"(.*)\"")
-
- def __init__(self, log_name):
- self.log_name = log_name
-
- def ReadNameMap(self):
- log = open(self.log_name, "r")
- try:
- snapshot_pos_to_name = {}
- for line in log:
- match = SnapshotLogReader._SNAPSHOT_CODE_NAME_RE.match(line)
- if match:
- pos = int(match.group(1))
- name = match.group(2)
- snapshot_pos_to_name[pos] = name
- finally:
- log.close()
- return snapshot_pos_to_name
-
-
class LogReader(object):
"""V8 low-level (binary) log reader."""
@@ -365,16 +337,13 @@ class LogReader(object):
_CODE_CREATE_TAG = "C"
_CODE_MOVE_TAG = "M"
- _SNAPSHOT_POSITION_TAG = "P"
_CODE_MOVING_GC_TAG = "G"
- def __init__(self, log_name, code_map, snapshot_pos_to_name):
+ def __init__(self, log_name, code_map):
self.log_file = open(log_name, "r")
self.log = mmap.mmap(self.log_file.fileno(), 0, mmap.MAP_PRIVATE)
self.log_pos = 0
self.code_map = code_map
- self.snapshot_pos_to_name = snapshot_pos_to_name
- self.address_to_snapshot_name = {}
self.arch = self.log[:self.log.find("\0")]
self.log_pos += len(self.arch) + 1
@@ -394,17 +363,12 @@ class LogReader(object):
self.code_delete_struct = LogReader._DefineStruct([
("address", pointer_type)])
- self.snapshot_position_struct = LogReader._DefineStruct([
- ("address", pointer_type),
- ("position", ctypes.c_int32)])
-
def ReadUpToGC(self):
while self.log_pos < self.log.size():
tag = self.log[self.log_pos]
self.log_pos += 1
if tag == LogReader._CODE_MOVING_GC_TAG:
- self.address_to_snapshot_name.clear()
return
if tag == LogReader._CODE_CREATE_TAG:
@@ -412,12 +376,8 @@ class LogReader(object):
self.log_pos += ctypes.sizeof(event)
start_address = event.code_address
end_address = start_address + event.code_size
- if start_address in self.address_to_snapshot_name:
- name = self.address_to_snapshot_name[start_address]
- origin = JS_SNAPSHOT_ORIGIN
- else:
- name = self.log[self.log_pos:self.log_pos + event.name_size]
- origin = JS_ORIGIN
+ name = self.log[self.log_pos:self.log_pos + event.name_size]
+ origin = JS_ORIGIN
self.log_pos += event.name_size
origin_offset = self.log_pos
self.log_pos += event.code_size
@@ -458,17 +418,6 @@ class LogReader(object):
self.code_map.Add(code)
continue
- if tag == LogReader._SNAPSHOT_POSITION_TAG:
- event = self.snapshot_position_struct.from_buffer(self.log,
- self.log_pos)
- self.log_pos += ctypes.sizeof(event)
- start_address = event.address
- snapshot_pos = event.position
- if snapshot_pos in self.snapshot_pos_to_name:
- self.address_to_snapshot_name[start_address] = \
- self.snapshot_pos_to_name[snapshot_pos]
- continue
-
assert False, "Unknown tag %s" % tag
def Dispose(self):
@@ -884,16 +833,9 @@ def PrintDot(code_map, options):
if __name__ == "__main__":
parser = optparse.OptionParser(USAGE)
- parser.add_option("--snapshot-log",
- default="obj/release/snapshot.log",
- help="V8 snapshot log file name [default: %default]")
parser.add_option("--log",
default="v8.log",
help="V8 log file name [default: %default]")
- parser.add_option("--snapshot",
- default=False,
- action="store_true",
- help="process V8 snapshot log [default: %default]")
parser.add_option("--trace",
default="perf.data",
help="perf trace file name [default: %default]")
@@ -931,12 +873,7 @@ if __name__ == "__main__":
options, args = parser.parse_args()
if not options.quiet:
- if options.snapshot:
- print "V8 logs: %s, %s, %s.ll" % (options.snapshot_log,
- options.log,
- options.log)
- else:
- print "V8 log: %s, %s.ll (no snapshot)" % (options.log, options.log)
+ print "V8 log: %s, %s.ll" % (options.log, options.log)
print "Perf trace file: %s" % options.trace
V8_GC_FAKE_MMAP = options.gc_fake_mmap
@@ -958,17 +895,10 @@ if __name__ == "__main__":
mmap_time = 0
sample_time = 0
- # Process the snapshot log to fill the snapshot name map.
- snapshot_name_map = {}
- if options.snapshot:
- snapshot_log_reader = SnapshotLogReader(log_name=options.snapshot_log)
- snapshot_name_map = snapshot_log_reader.ReadNameMap()
-
# Initialize the log reader.
code_map = CodeMap()
log_reader = LogReader(log_name=options.log + ".ll",
- code_map=code_map,
- snapshot_pos_to_name=snapshot_name_map)
+ code_map=code_map)
if not options.quiet:
print "Generated code architecture: %s" % log_reader.arch
print
« no previous file with comments | « tools/gyp/v8.gyp ('k') | tools/profviz/worker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698