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

Side by Side Diff: src/d8.cc

Issue 10702168: Add counters that automatically track object sizes and counts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Whitespace change Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/d8.h ('k') | src/flag-definitions.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 for (CounterMap::Iterator i(counter_map_); i.More(); i.Next()) { 1294 for (CounterMap::Iterator i(counter_map_); i.More(); i.Next()) {
1295 number_of_counters++; 1295 number_of_counters++;
1296 } 1296 }
1297 CounterAndKey* counters = new CounterAndKey[number_of_counters]; 1297 CounterAndKey* counters = new CounterAndKey[number_of_counters];
1298 int j = 0; 1298 int j = 0;
1299 for (CounterMap::Iterator i(counter_map_); i.More(); i.Next(), j++) { 1299 for (CounterMap::Iterator i(counter_map_); i.More(); i.Next(), j++) {
1300 counters[j].counter = i.CurrentValue(); 1300 counters[j].counter = i.CurrentValue();
1301 counters[j].key = i.CurrentKey(); 1301 counters[j].key = i.CurrentKey();
1302 } 1302 }
1303 qsort(counters, number_of_counters, sizeof(counters[0]), CompareKeys); 1303 qsort(counters, number_of_counters, sizeof(counters[0]), CompareKeys);
1304 printf("+--------------------------------------------+-------------+\n"); 1304 printf("+----------------------------------------------------------------+"
1305 printf("| Name | Value |\n"); 1305 "-------------+\n");
1306 printf("+--------------------------------------------+-------------+\n"); 1306 printf("| Name |"
1307 " Value |\n");
1308 printf("+----------------------------------------------------------------+"
1309 "-------------+\n");
1307 for (j = 0; j < number_of_counters; j++) { 1310 for (j = 0; j < number_of_counters; j++) {
1308 Counter* counter = counters[j].counter; 1311 Counter* counter = counters[j].counter;
1309 const char* key = counters[j].key; 1312 const char* key = counters[j].key;
1310 if (counter->is_histogram()) { 1313 if (counter->is_histogram()) {
1311 printf("| c:%-40s | %11i |\n", key, counter->count()); 1314 printf("| c:%-60s | %11i |\n", key, counter->count());
1312 printf("| t:%-40s | %11i |\n", key, counter->sample_total()); 1315 printf("| t:%-60s | %11i |\n", key, counter->sample_total());
1313 } else { 1316 } else {
1314 printf("| %-42s | %11i |\n", key, counter->count()); 1317 printf("| %-62s | %11i |\n", key, counter->count());
1315 } 1318 }
1316 } 1319 }
1317 printf("+--------------------------------------------+-------------+\n"); 1320 printf("+----------------------------------------------------------------+"
1321 "-------------+\n");
1318 delete [] counters; 1322 delete [] counters;
1319 } 1323 }
1320 delete counters_file_; 1324 delete counters_file_;
1321 delete counter_map_; 1325 delete counter_map_;
1322 } 1326 }
1323 #endif // V8_SHARED 1327 #endif // V8_SHARED
1324 1328
1325 1329
1326 static FILE* FOpen(const char* path, const char* mode) { 1330 static FILE* FOpen(const char* path, const char* mode) {
1327 #if defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)) 1331 #if defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 } 1893 }
1890 1894
1891 } // namespace v8 1895 } // namespace v8
1892 1896
1893 1897
1894 #ifndef GOOGLE3 1898 #ifndef GOOGLE3
1895 int main(int argc, char* argv[]) { 1899 int main(int argc, char* argv[]) {
1896 return v8::Shell::Main(argc, argv); 1900 return v8::Shell::Main(argc, argv);
1897 } 1901 }
1898 #endif 1902 #endif
OLDNEW
« no previous file with comments | « src/d8.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698