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

Side by Side Diff: src/cpu-profiler.cc

Issue 7003108: "Deiceolate" Thread classes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 28 matching lines...) Expand all
39 #include "../include/v8-profiler.h" 39 #include "../include/v8-profiler.h"
40 40
41 namespace v8 { 41 namespace v8 {
42 namespace internal { 42 namespace internal {
43 43
44 static const int kEventsBufferSize = 256*KB; 44 static const int kEventsBufferSize = 256*KB;
45 static const int kTickSamplesBufferChunkSize = 64*KB; 45 static const int kTickSamplesBufferChunkSize = 64*KB;
46 static const int kTickSamplesBufferChunksCount = 16; 46 static const int kTickSamplesBufferChunksCount = 16;
47 47
48 48
49 ProfilerEventsProcessor::ProfilerEventsProcessor(Isolate* isolate, 49 ProfilerEventsProcessor::ProfilerEventsProcessor(ProfileGenerator* generator)
50 ProfileGenerator* generator) 50 : Thread("v8:ProfEvntProc"),
51 : Thread(isolate, "v8:ProfEvntProc"),
52 generator_(generator), 51 generator_(generator),
53 running_(true), 52 running_(true),
54 ticks_buffer_(sizeof(TickSampleEventRecord), 53 ticks_buffer_(sizeof(TickSampleEventRecord),
55 kTickSamplesBufferChunkSize, 54 kTickSamplesBufferChunkSize,
56 kTickSamplesBufferChunksCount), 55 kTickSamplesBufferChunksCount),
57 enqueue_order_(0) { 56 enqueue_order_(0) {
58 } 57 }
59 58
60 59
61 void ProfilerEventsProcessor::CallbackCreateEvent(Logger::LogEventsAndTags tag, 60 void ProfilerEventsProcessor::CallbackCreateEvent(Logger::LogEventsAndTags tag,
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 499
501 500
502 void CpuProfiler::StartProcessorIfNotStarted() { 501 void CpuProfiler::StartProcessorIfNotStarted() {
503 if (processor_ == NULL) { 502 if (processor_ == NULL) {
504 Isolate* isolate = Isolate::Current(); 503 Isolate* isolate = Isolate::Current();
505 504
506 // Disable logging when using the new implementation. 505 // Disable logging when using the new implementation.
507 saved_logging_nesting_ = isolate->logger()->logging_nesting_; 506 saved_logging_nesting_ = isolate->logger()->logging_nesting_;
508 isolate->logger()->logging_nesting_ = 0; 507 isolate->logger()->logging_nesting_ = 0;
509 generator_ = new ProfileGenerator(profiles_); 508 generator_ = new ProfileGenerator(profiles_);
510 processor_ = new ProfilerEventsProcessor(isolate, generator_); 509 processor_ = new ProfilerEventsProcessor(generator_);
511 NoBarrier_Store(&is_profiling_, true); 510 NoBarrier_Store(&is_profiling_, true);
512 processor_->Start(); 511 processor_->Start();
513 // Enumerate stuff we already have in the heap. 512 // Enumerate stuff we already have in the heap.
514 if (isolate->heap()->HasBeenSetup()) { 513 if (isolate->heap()->HasBeenSetup()) {
515 if (!FLAG_prof_browser_mode) { 514 if (!FLAG_prof_browser_mode) {
516 bool saved_log_code_flag = FLAG_log_code; 515 bool saved_log_code_flag = FLAG_log_code;
517 FLAG_log_code = true; 516 FLAG_log_code = true;
518 isolate->logger()->LogCodeObjects(); 517 isolate->logger()->LogCodeObjects();
519 FLAG_log_code = saved_log_code_flag; 518 FLAG_log_code = saved_log_code_flag;
520 } 519 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 #ifdef ENABLE_LOGGING_AND_PROFILING 599 #ifdef ENABLE_LOGGING_AND_PROFILING
601 Isolate* isolate = Isolate::Current(); 600 Isolate* isolate = Isolate::Current();
602 if (isolate->cpu_profiler() != NULL) { 601 if (isolate->cpu_profiler() != NULL) {
603 delete isolate->cpu_profiler(); 602 delete isolate->cpu_profiler();
604 } 603 }
605 isolate->set_cpu_profiler(NULL); 604 isolate->set_cpu_profiler(NULL);
606 #endif 605 #endif
607 } 606 }
608 607
609 } } // namespace v8::internal 608 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698