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

Unified Diff: tracing/tracing/extras/importer/trace_code_entry.html

Issue 1276003004: Process v8 sampling data into the trace model. (Closed) Base URL: git@github.com:catapult-project/catapult.git@master
Patch Set: Created 5 years, 4 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
Index: tracing/tracing/extras/importer/trace_code_entry.html
diff --git a/tracing/tracing/extras/importer/trace_code_entry.html b/tracing/tracing/extras/importer/trace_code_entry.html
new file mode 100644
index 0000000000000000000000000000000000000000..1a989580a1aa721c48277f230c271c8787016898
--- /dev/null
+++ b/tracing/tracing/extras/importer/trace_code_entry.html
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<!--
+Copyright 2015 The Chromium Authors. All rights reserved.
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+-->
+
+<link rel="import" href="/tracing/extras/importer/v8/codemap.html">
+<link rel="import" href="/tracing/model/source_info/js_source_info.html">
+
+<script>
+'use strict';
+
+/**
+ * @fileoverview TraceCodeEntry is a wrapper around the V8 CodeEntry to extract
petrcermak 2015/08/12 10:53:24 nit: s/to extract/which extracts/ ?
dsinclair 2015/08/13 14:55:32 I think to was also correct, but changed to that f
+ * extra context information for each item. This includes things like the
+ * source file, line and if the function is a native method or not.
+ */
+tr.exportTo('tr.e.importer', function() {
+ function TraceCodeEntry(size, name, script_id) {
petrcermak 2015/08/12 10:53:24 It seems that we generally use camel case for func
dsinclair 2015/08/13 14:55:32 Done.
+ var method_name = undefined;
+ var script = undefined;
+ var line_num = -1;
+ var is_native = false;
+
+ if (name.startsWith('LazyCompile:')) {
+ var clean_name = name.replace(/LazyCompile:~?/, '');
+ var idx = clean_name.lastIndexOf(' ');
+ if (idx < 0) {
+ method_name = clean_name;
+ } else {
+ method_name = clean_name.substring(0, idx);
+ script = clean_name.substring(idx + 1);
+
+ var matches = script.match(/(.*):(\d+)$/);
+ if (matches !== null) {
+ script = matches[1];
+ line_num = parseInt(matches[2]);
+ }
+ }
+
+ if (method_name.endsWith(' native')) {
+ is_native = true;
+ method_name = method_name.replace(/\s+native\s*$/, '');
petrcermak 2015/08/12 10:53:24 nit: No need for '\s*' in the regex as you check t
dsinclair 2015/08/13 14:55:32 Done.
+ }
+
+ if (method_name === '')
+ method_name = 'unknown';
+ } else {
+ method_name = name;
+ }
+
+ tr.e.importer.v8.CodeMap.CodeEntry.call(this, size, method_name);
+
+ this.sourceInfo_ = new tr.model.source_info.JSSourceInfo(
+ script, line_num, is_native, script_id);
+ };
+
+ TraceCodeEntry.prototype = {
+ __proto__: tr.e.importer.v8.CodeMap.CodeEntry.prototype,
+
+ get sourceInfo() {
+ return this.sourceInfo_;
+ }
+ };
+
+ return {
+ TraceCodeEntry: TraceCodeEntry
+ };
+});
+</script>
+

Powered by Google App Engine
This is Rietveld 408576698