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

Side by Side Diff: src/log.cc

Issue 7276046: Remove "modules" and "tags" of the logging CPU profiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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/log.h ('k') | src/runtime.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 } 1355 }
1356 for (int i = 0; i < sample->frames_count; ++i) { 1356 for (int i = 0; i < sample->frames_count; ++i) {
1357 msg.Append(','); 1357 msg.Append(',');
1358 msg.AppendAddress(sample->stack[i]); 1358 msg.AppendAddress(sample->stack[i]);
1359 } 1359 }
1360 msg.Append('\n'); 1360 msg.Append('\n');
1361 msg.WriteToLogFile(); 1361 msg.WriteToLogFile();
1362 } 1362 }
1363 1363
1364 1364
1365 int Logger::GetActiveProfilerModules() { 1365 bool Logger::IsProfilerPaused() {
1366 int result = PROFILER_MODULE_NONE; 1366 return profiler_ == NULL || profiler_->paused();
1367 if (profiler_ != NULL && !profiler_->paused()) {
1368 result |= PROFILER_MODULE_CPU;
1369 }
1370 return result;
1371 } 1367 }
1372 1368
1373 1369
1374 void Logger::PauseProfiler(int flags, int tag) { 1370 void Logger::PauseProfiler() {
1375 if (!log_->IsEnabled()) return; 1371 if (!log_->IsEnabled()) return;
1376 if (profiler_ != NULL && (flags & PROFILER_MODULE_CPU)) { 1372 if (profiler_ != NULL) {
1377 // It is OK to have negative nesting. 1373 // It is OK to have negative nesting.
1378 if (--cpu_profiler_nesting_ == 0) { 1374 if (--cpu_profiler_nesting_ == 0) {
1379 profiler_->pause(); 1375 profiler_->pause();
1380 if (FLAG_prof_lazy) { 1376 if (FLAG_prof_lazy) {
1381 if (!FLAG_sliding_state_window && !RuntimeProfiler::IsEnabled()) { 1377 if (!FLAG_sliding_state_window && !RuntimeProfiler::IsEnabled()) {
1382 ticker_->Stop(); 1378 ticker_->Stop();
1383 } 1379 }
1384 FLAG_log_code = false; 1380 FLAG_log_code = false;
1385 // Must be the same message as Log::kDynamicBufferSeal. 1381 // Must be the same message as Log::kDynamicBufferSeal.
1386 LOG(ISOLATE, UncheckedStringEvent("profiler", "pause")); 1382 LOG(ISOLATE, UncheckedStringEvent("profiler", "pause"));
1387 } 1383 }
1388 --logging_nesting_; 1384 --logging_nesting_;
1389 } 1385 }
1390 } 1386 }
1391 if (tag != 0) {
1392 UncheckedIntEvent("close-tag", tag);
1393 }
1394 } 1387 }
1395 1388
1396 1389
1397 void Logger::ResumeProfiler(int flags, int tag) { 1390 void Logger::ResumeProfiler() {
1398 if (!log_->IsEnabled()) return; 1391 if (!log_->IsEnabled()) return;
1399 if (tag != 0) { 1392 if (profiler_ != NULL) {
1400 UncheckedIntEvent("open-tag", tag);
1401 }
1402 if (profiler_ != NULL && (flags & PROFILER_MODULE_CPU)) {
1403 if (cpu_profiler_nesting_++ == 0) { 1393 if (cpu_profiler_nesting_++ == 0) {
1404 ++logging_nesting_; 1394 ++logging_nesting_;
1405 if (FLAG_prof_lazy) { 1395 if (FLAG_prof_lazy) {
1406 profiler_->Engage(); 1396 profiler_->Engage();
1407 LOG(ISOLATE, UncheckedStringEvent("profiler", "resume")); 1397 LOG(ISOLATE, UncheckedStringEvent("profiler", "resume"));
1408 FLAG_log_code = true; 1398 FLAG_log_code = true;
1409 LogCompiledFunctions(); 1399 LogCompiledFunctions();
1410 LogAccessorCallbacks(); 1400 LogAccessorCallbacks();
1411 if (!FLAG_sliding_state_window && !ticker_->IsActive()) { 1401 if (!FLAG_sliding_state_window && !ticker_->IsActive()) {
1412 ticker_->Start(); 1402 ticker_->Start();
1413 } 1403 }
1414 } 1404 }
1415 profiler_->resume(); 1405 profiler_->resume();
1416 } 1406 }
1417 } 1407 }
1418 } 1408 }
1419 1409
1420 1410
1421 // This function can be called when Log's mutex is acquired, 1411 // This function can be called when Log's mutex is acquired,
1422 // either from main or Profiler's thread. 1412 // either from main or Profiler's thread.
1423 void Logger::LogFailure() { 1413 void Logger::LogFailure() {
1424 PauseProfiler(PROFILER_MODULE_CPU, 0); 1414 PauseProfiler();
1425 } 1415 }
1426 1416
1427 1417
1428 bool Logger::IsProfilerSamplerActive() { 1418 bool Logger::IsProfilerSamplerActive() {
1429 return ticker_->IsActive(); 1419 return ticker_->IsActive();
1430 } 1420 }
1431 1421
1432 1422
1433 int Logger::GetLogLines(int from_pos, char* dest_buf, int max_size) { 1423 int Logger::GetLogLines(int from_pos, char* dest_buf, int max_size) {
1434 return log_->GetLogLines(from_pos, dest_buf, max_size); 1424 return log_->GetLogLines(from_pos, dest_buf, max_size);
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1896 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { 1886 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) {
1897 ASSERT(sampler->IsActive()); 1887 ASSERT(sampler->IsActive());
1898 ScopedLock lock(mutex_); 1888 ScopedLock lock(mutex_);
1899 ASSERT(active_samplers_ != NULL); 1889 ASSERT(active_samplers_ != NULL);
1900 bool removed = active_samplers_->RemoveElement(sampler); 1890 bool removed = active_samplers_->RemoveElement(sampler);
1901 ASSERT(removed); 1891 ASSERT(removed);
1902 USE(removed); 1892 USE(removed);
1903 } 1893 }
1904 1894
1905 } } // namespace v8::internal 1895 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log.h ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698