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

Side by Side Diff: tools/profile.js

Issue 2753543006: [profiler] Web UI: add summary of opts/deopts. (Closed)
Patch Set: Address reviewer comments Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « test/mjsunit/tools/tickprocessor-test-func-info.log ('k') | tools/profview/index.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 /** 129 /**
130 * Registers dynamic (JIT-compiled) code entry. 130 * Registers dynamic (JIT-compiled) code entry.
131 * 131 *
132 * @param {string} type Code entry type. 132 * @param {string} type Code entry type.
133 * @param {string} name Code entry name. 133 * @param {string} name Code entry name.
134 * @param {number} start Starting address. 134 * @param {number} start Starting address.
135 * @param {number} size Code entry size. 135 * @param {number} size Code entry size.
136 */ 136 */
137 Profile.prototype.addCode = function( 137 Profile.prototype.addCode = function(
138 type, name, start, size) { 138 type, name, timestamp, start, size) {
139 var entry = new Profile.DynamicCodeEntry(size, type, name); 139 var entry = new Profile.DynamicCodeEntry(size, type, name);
140 this.codeMap_.addCode(start, entry); 140 this.codeMap_.addCode(start, entry);
141 return entry; 141 return entry;
142 }; 142 };
143 143
144 144
145 /** 145 /**
146 * Registers dynamic (JIT-compiled) code entry. 146 * Registers dynamic (JIT-compiled) code entry.
147 * 147 *
148 * @param {string} type Code entry type. 148 * @param {string} type Code entry type.
149 * @param {string} name Code entry name. 149 * @param {string} name Code entry name.
150 * @param {number} start Starting address. 150 * @param {number} start Starting address.
151 * @param {number} size Code entry size. 151 * @param {number} size Code entry size.
152 * @param {number} funcAddr Shared function object address. 152 * @param {number} funcAddr Shared function object address.
153 * @param {Profile.CodeState} state Optimization state. 153 * @param {Profile.CodeState} state Optimization state.
154 */ 154 */
155 Profile.prototype.addFuncCode = function( 155 Profile.prototype.addFuncCode = function(
156 type, name, start, size, funcAddr, state) { 156 type, name, timestamp, start, size, funcAddr, state) {
157 // As code and functions are in the same address space, 157 // As code and functions are in the same address space,
158 // it is safe to put them in a single code map. 158 // it is safe to put them in a single code map.
159 var func = this.codeMap_.findDynamicEntryByStartAddress(funcAddr); 159 var func = this.codeMap_.findDynamicEntryByStartAddress(funcAddr);
160 if (!func) { 160 if (!func) {
161 func = new Profile.FunctionEntry(name); 161 func = new Profile.FunctionEntry(name);
162 this.codeMap_.addCode(funcAddr, func); 162 this.codeMap_.addCode(funcAddr, func);
163 } else if (func.name !== name) { 163 } else if (func.name !== name) {
164 // Function object has been overwritten with a new one. 164 // Function object has been overwritten with a new one.
165 func.name = name; 165 func.name = name;
166 } 166 }
(...skipping 18 matching lines...) Expand all
185 * @param {number} to New code entry address. 185 * @param {number} to New code entry address.
186 */ 186 */
187 Profile.prototype.moveCode = function(from, to) { 187 Profile.prototype.moveCode = function(from, to) {
188 try { 188 try {
189 this.codeMap_.moveCode(from, to); 189 this.codeMap_.moveCode(from, to);
190 } catch (e) { 190 } catch (e) {
191 this.handleUnknownCode(Profile.Operation.MOVE, from); 191 this.handleUnknownCode(Profile.Operation.MOVE, from);
192 } 192 }
193 }; 193 };
194 194
195 Profile.prototype.deoptCode = function(
196 timestamp, code, inliningId, scriptOffset, bailoutType,
197 sourcePositionText, deoptReasonText) {
198 };
195 199
196 /** 200 /**
197 * Reports about deletion of a dynamic code entry. 201 * Reports about deletion of a dynamic code entry.
198 * 202 *
199 * @param {number} start Starting address. 203 * @param {number} start Starting address.
200 */ 204 */
201 Profile.prototype.deleteCode = function(start) { 205 Profile.prototype.deleteCode = function(start) {
202 try { 206 try {
203 this.codeMap_.deleteCode(start); 207 this.codeMap_.deleteCode(start);
204 } catch (e) { 208 } catch (e) {
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 var entry = new CodeMap.CodeEntry( 861 var entry = new CodeMap.CodeEntry(
858 endAddr - startAddr, name, 'CPP'); 862 endAddr - startAddr, name, 'CPP');
859 this.codeMap_.addStaticCode(startAddr, entry); 863 this.codeMap_.addStaticCode(startAddr, entry);
860 864
861 entry.codeId = this.codeEntries_.length; 865 entry.codeId = this.codeEntries_.length;
862 this.codeEntries_.push({name : entry.name, type : entry.type}); 866 this.codeEntries_.push({name : entry.name, type : entry.type});
863 return entry; 867 return entry;
864 }; 868 };
865 869
866 JsonProfile.prototype.addCode = function( 870 JsonProfile.prototype.addCode = function(
867 kind, name, start, size) { 871 kind, name, timestamp, start, size) {
868 var entry = new CodeMap.CodeEntry(size, name, 'CODE'); 872 var entry = new CodeMap.CodeEntry(size, name, 'CODE');
869 this.codeMap_.addCode(start, entry); 873 this.codeMap_.addCode(start, entry);
870 874
871 entry.codeId = this.codeEntries_.length; 875 entry.codeId = this.codeEntries_.length;
872 this.codeEntries_.push({name : entry.name, type : entry.type, kind : kind}); 876 this.codeEntries_.push({
877 name : entry.name,
878 timestamp: timestamp,
879 type : entry.type,
880 kind : kind
881 });
873 882
874 return entry; 883 return entry;
875 }; 884 };
876 885
877 JsonProfile.prototype.addFuncCode = function( 886 JsonProfile.prototype.addFuncCode = function(
878 kind, name, start, size, funcAddr, state) { 887 kind, name, timestamp, start, size, funcAddr, state) {
879 // As code and functions are in the same address space, 888 // As code and functions are in the same address space,
880 // it is safe to put them in a single code map. 889 // it is safe to put them in a single code map.
881 var func = this.codeMap_.findDynamicEntryByStartAddress(funcAddr); 890 var func = this.codeMap_.findDynamicEntryByStartAddress(funcAddr);
882 if (!func) { 891 if (!func) {
883 var func = new CodeMap.CodeEntry(0, name, 'SFI'); 892 var func = new CodeMap.CodeEntry(0, name, 'SFI');
884 this.codeMap_.addCode(funcAddr, func); 893 this.codeMap_.addCode(funcAddr, func);
885 894
886 func.funcId = this.functionEntries_.length; 895 func.funcId = this.functionEntries_.length;
887 this.functionEntries_.push({name : name, codes : []}); 896 this.functionEntries_.push({name : name, codes : []});
888 } else if (func.name !== name) { 897 } else if (func.name !== name) {
(...skipping 25 matching lines...) Expand all
914 } else if (state === 1) { 923 } else if (state === 1) {
915 kind = "Unopt"; 924 kind = "Unopt";
916 } else if (state === 2) { 925 } else if (state === 2) {
917 kind = "Opt"; 926 kind = "Opt";
918 } 927 }
919 928
920 this.codeEntries_.push({ 929 this.codeEntries_.push({
921 name : entry.name, 930 name : entry.name,
922 type : entry.type, 931 type : entry.type,
923 kind : kind, 932 kind : kind,
924 func : func.funcId 933 func : func.funcId,
934 tm : timestamp
925 }); 935 });
926 } 936 }
927 return entry; 937 return entry;
928 }; 938 };
929 939
930 JsonProfile.prototype.moveCode = function(from, to) { 940 JsonProfile.prototype.moveCode = function(from, to) {
931 try { 941 try {
932 this.codeMap_.moveCode(from, to); 942 this.codeMap_.moveCode(from, to);
933 } catch (e) { 943 } catch (e) {
934 printErr("Move: unknown source " + from); 944 printErr("Move: unknown source " + from);
935 } 945 }
936 }; 946 };
937 947
948 JsonProfile.prototype.deoptCode = function(
949 timestamp, code, inliningId, scriptOffset, bailoutType,
950 sourcePositionText, deoptReasonText) {
951 let entry = this.codeMap_.findDynamicEntryByStartAddress(code);
952 if (entry) {
953 let codeId = entry.codeId;
954 if (!this.codeEntries_[codeId].deopt) {
955 // Only add the deopt if there was no deopt before.
956 // The subsequent deoptimizations should be lazy deopts for
957 // other on-stack activations.
958 this.codeEntries_[codeId].deopt = {
959 tm : timestamp,
960 inliningId : inliningId,
961 scriptOffset : scriptOffset,
962 posText : sourcePositionText,
963 reason : deoptReasonText,
964 bailoutType : bailoutType
965 };
966 }
967 }
968 };
969
938 JsonProfile.prototype.deleteCode = function(start) { 970 JsonProfile.prototype.deleteCode = function(start) {
939 try { 971 try {
940 this.codeMap_.deleteCode(start); 972 this.codeMap_.deleteCode(start);
941 } catch (e) { 973 } catch (e) {
942 printErr("Delete: unknown address " + start); 974 printErr("Delete: unknown address " + start);
943 } 975 }
944 }; 976 };
945 977
946 JsonProfile.prototype.moveFunc = function(from, to) { 978 JsonProfile.prototype.moveFunc = function(from, to) {
947 if (this.codeMap_.findDynamicEntryByStartAddress(from)) { 979 if (this.codeMap_.findDynamicEntryByStartAddress(from)) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 write(' ' + JSON.stringify(this.ticks_[i])); 1011 write(' ' + JSON.stringify(this.ticks_[i]));
980 if (i < this.ticks_.length - 1) { 1012 if (i < this.ticks_.length - 1) {
981 write(',\n'); 1013 write(',\n');
982 } else { 1014 } else {
983 write('\n'); 1015 write('\n');
984 } 1016 }
985 } 1017 }
986 write(' ]\n'); 1018 write(' ]\n');
987 write('}\n'); 1019 write('}\n');
988 }; 1020 };
OLDNEW
« no previous file with comments | « test/mjsunit/tools/tickprocessor-test-func-info.log ('k') | tools/profview/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698