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

Side by Side Diff: chrome_frame/test/perf/chrome_frame_perftest.cc

Issue 4517004: Move Windows-specific Event Tracing for Windows implementation to base/win. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixed another ETW user in Chrome Frame Created 10 years, 1 month 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 | « base/win/event_trace_provider_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #include "chrome_frame/test/perf/chrome_frame_perftest.h" 4 #include "chrome_frame/test/perf/chrome_frame_perftest.h"
5 5
6 #include <atlwin.h> 6 #include <atlwin.h>
7 #include <atlhost.h> 7 #include <atlhost.h>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 #include <string> 10 #include <string>
11 11
12 #include "chrome_tab.h" // Generated from chrome_tab.idl. 12 #include "chrome_tab.h" // Generated from chrome_tab.idl.
13 13
14 #include "base/event_trace_controller_win.h"
15 #include "base/event_trace_consumer_win.h"
16 #include "base/file_path.h" 14 #include "base/file_path.h"
17 #include "base/file_util.h" 15 #include "base/file_util.h"
18 #include "base/path_service.h" 16 #include "base/path_service.h"
19 #include "base/process_util.h" 17 #include "base/process_util.h"
20 #include "base/scoped_ptr.h" 18 #include "base/scoped_ptr.h"
21 #include "base/string_util.h" 19 #include "base/string_util.h"
22 #include "base/stringprintf.h" 20 #include "base/stringprintf.h"
23 #include "base/time.h" 21 #include "base/time.h"
24 #include "base/debug/trace_event_win.h" 22 #include "base/debug/trace_event_win.h"
25 #include "base/utf_string_conversions.h" 23 #include "base/utf_string_conversions.h"
24 #include "base/win/event_trace_controller.h"
25 #include "base/win/event_trace_consumer.h"
26 #include "base/win/registry.h" 26 #include "base/win/registry.h"
27 #include "base/win/scoped_bstr.h" 27 #include "base/win/scoped_bstr.h"
28 #include "base/win/scoped_comptr.h" 28 #include "base/win/scoped_comptr.h"
29 #include "base/win/scoped_variant.h" 29 #include "base/win/scoped_variant.h"
30 #include "chrome/common/chrome_constants.h" 30 #include "chrome/common/chrome_constants.h"
31 #include "chrome/common/chrome_paths.h" 31 #include "chrome/common/chrome_paths.h"
32 #include "chrome/common/chrome_paths_internal.h" 32 #include "chrome/common/chrome_paths_internal.h"
33 #include "chrome/test/chrome_process_util.h" 33 #include "chrome/test/chrome_process_util.h"
34 #include "chrome/test/ui/ui_perf_test.h" 34 #include "chrome/test/ui/ui_perf_test.h"
35 35
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 virtual void OnTraceEventBegin(EVENT_TRACE* event) {} 1136 virtual void OnTraceEventBegin(EVENT_TRACE* event) {}
1137 virtual void OnTraceEventEnd(EVENT_TRACE* event) {} 1137 virtual void OnTraceEventEnd(EVENT_TRACE* event) {}
1138 virtual void OnTraceEventInstant(EVENT_TRACE* event) {} 1138 virtual void OnTraceEventInstant(EVENT_TRACE* event) {}
1139 }; 1139 };
1140 1140
1141 // For the time being we pass to delegate only base::kTraceEventClass32 1141 // For the time being we pass to delegate only base::kTraceEventClass32
1142 // events i.e. these generated by TRACE_EVENT_XXXX macros. 1142 // events i.e. these generated by TRACE_EVENT_XXXX macros.
1143 // We may need to add kernel provider and pass Process Start/Exit events etc, 1143 // We may need to add kernel provider and pass Process Start/Exit events etc,
1144 // but for the time being we stick with base::kChromeTraceProviderName 1144 // but for the time being we stick with base::kChromeTraceProviderName
1145 // provider only. 1145 // provider only.
1146 class EtwConsumer : public EtwTraceConsumerBase<EtwConsumer> { 1146 class EtwConsumer : public base::win::EtwTraceConsumerBase<EtwConsumer> {
1147 public: 1147 public:
1148 EtwConsumer() { 1148 EtwConsumer() {
1149 set_delegate(NULL); 1149 set_delegate(NULL);
1150 } 1150 }
1151 1151
1152 ~EtwConsumer() { 1152 ~EtwConsumer() {
1153 set_delegate(NULL); 1153 set_delegate(NULL);
1154 } 1154 }
1155 1155
1156 void set_delegate(TracedEvents* delegate) { 1156 void set_delegate(TracedEvents* delegate) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 public: 1190 public:
1191 EtwPerfSession() { 1191 EtwPerfSession() {
1192 } 1192 }
1193 1193
1194 ~EtwPerfSession() { 1194 ~EtwPerfSession() {
1195 file_util::Delete(etl_log_file_, false); 1195 file_util::Delete(etl_log_file_, false);
1196 } 1196 }
1197 1197
1198 void Start() { 1198 void Start() {
1199 // To ensure there is no session leftover from crashes, previous runs, etc. 1199 // To ensure there is no session leftover from crashes, previous runs, etc.
1200 EtwTraceProperties ignore; 1200 base::win::EtwTraceProperties ignore;
1201 EtwTraceController::Stop(L"cf_perf", &ignore); 1201 base::win::EtwTraceController::Stop(L"cf_perf", &ignore);
1202 ASSERT_TRUE(file_util::CreateTemporaryFile(&etl_log_file_)); 1202 ASSERT_TRUE(file_util::CreateTemporaryFile(&etl_log_file_));
1203 ASSERT_HRESULT_SUCCEEDED(controller_.StartFileSession(L"cf_perf", 1203 ASSERT_HRESULT_SUCCEEDED(controller_.StartFileSession(L"cf_perf",
1204 etl_log_file_.value().c_str(), false)); 1204 etl_log_file_.value().c_str(), false));
1205 ASSERT_HRESULT_SUCCEEDED(controller_.EnableProvider( 1205 ASSERT_HRESULT_SUCCEEDED(controller_.EnableProvider(
1206 base::debug::kChromeTraceProviderName, 1206 base::debug::kChromeTraceProviderName,
1207 TRACE_LEVEL_INFORMATION, 1207 TRACE_LEVEL_INFORMATION,
1208 ~(base::debug::CAPTURE_STACK_TRACE))); 1208 ~(base::debug::CAPTURE_STACK_TRACE)));
1209 } 1209 }
1210 1210
1211 HRESULT Stop() { 1211 HRESULT Stop() {
1212 return controller_.Stop(NULL); 1212 return controller_.Stop(NULL);
1213 } 1213 }
1214 1214
1215 void AnalyzeOutput(TracedEvents* delegate) { 1215 void AnalyzeOutput(TracedEvents* delegate) {
1216 EtwConsumer consumer; 1216 EtwConsumer consumer;
1217 consumer.set_delegate(delegate); 1217 consumer.set_delegate(delegate);
1218 consumer.OpenFileSession(etl_log_file_.value().c_str()); 1218 consumer.OpenFileSession(etl_log_file_.value().c_str());
1219 consumer.Consume(); 1219 consumer.Consume();
1220 consumer.Close(); 1220 consumer.Close();
1221 } 1221 }
1222 1222
1223 FilePath etl_log_file_; 1223 FilePath etl_log_file_;
1224 EtwTraceController controller_; 1224 base::win::EtwTraceController controller_;
1225 }; 1225 };
1226 1226
1227 // Base class for the tracing event helper classes. 1227 // Base class for the tracing event helper classes.
1228 class MonitorTraceBase { 1228 class MonitorTraceBase {
1229 public: 1229 public:
1230 static bool IsMatchingEvent(EVENT_TRACE* event, 1230 static bool IsMatchingEvent(EVENT_TRACE* event,
1231 const base::StringPiece& event_to_compare) { 1231 const base::StringPiece& event_to_compare) {
1232 return event->MofLength > event_to_compare.size() && 1232 return event->MofLength > event_to_compare.size() &&
1233 (memcmp(event_to_compare.data(), event->MofData, 1233 (memcmp(event_to_compare.data(), event->MofData,
1234 event_to_compare.size() + 1) == 0); 1234 event_to_compare.size() + 1) == 0);
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 PrintPerfTestResults(automation_provider_connect_monitor, kNumCycles, 1456 PrintPerfTestResults(automation_provider_connect_monitor, kNumCycles,
1457 "automationproviderconnect"); 1457 "automationproviderconnect");
1458 PrintPerfTestResults(external_tab_navigate_monitor, kNumCycles, 1458 PrintPerfTestResults(external_tab_navigate_monitor, kNumCycles,
1459 "externaltabnavigate"); 1459 "externaltabnavigate");
1460 PrintPerfTestResults(renderer_main_monitor, kNumCycles, 1460 PrintPerfTestResults(renderer_main_monitor, kNumCycles,
1461 "beginrenderermain"); 1461 "beginrenderermain");
1462 #ifdef NDEBUG 1462 #ifdef NDEBUG
1463 PrintPerfTestResults(pre_read_chrome_monitor, kNumCycles, "PreReadImage"); 1463 PrintPerfTestResults(pre_read_chrome_monitor, kNumCycles, "PreReadImage");
1464 #endif // NDEBUG 1464 #endif // NDEBUG
1465 } 1465 }
OLDNEW
« no previous file with comments | « base/win/event_trace_provider_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698