OLD | NEW |
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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 Address prev_to_; | 498 Address prev_to_; |
499 // Logger::FunctionCreateEvent(...) | 499 // Logger::FunctionCreateEvent(...) |
500 Address prev_code_; | 500 Address prev_code_; |
501 | 501 |
502 int64_t epoch_; | 502 int64_t epoch_; |
503 | 503 |
504 friend class CpuProfiler; | 504 friend class CpuProfiler; |
505 }; | 505 }; |
506 | 506 |
507 | 507 |
508 // Process wide registry of samplers. | |
509 class SamplerRegistry : public AllStatic { | |
510 public: | |
511 enum State { | |
512 HAS_NO_SAMPLERS, | |
513 HAS_SAMPLERS, | |
514 HAS_CPU_PROFILING_SAMPLERS | |
515 }; | |
516 | |
517 static void SetUp(); | |
518 | |
519 typedef void (*VisitSampler)(Sampler*, void*); | |
520 | |
521 static State GetState(); | |
522 | |
523 // Iterates over all active samplers keeping the internal lock held. | |
524 // Returns whether there are any active samplers. | |
525 static bool IterateActiveSamplers(VisitSampler func, void* param); | |
526 | |
527 // Adds/Removes an active sampler. | |
528 static void AddActiveSampler(Sampler* sampler); | |
529 static void RemoveActiveSampler(Sampler* sampler); | |
530 | |
531 private: | |
532 static bool ActiveSamplersExist() { | |
533 return active_samplers_ != NULL && !active_samplers_->is_empty(); | |
534 } | |
535 | |
536 static List<Sampler*>* active_samplers_; | |
537 | |
538 DISALLOW_IMPLICIT_CONSTRUCTORS(SamplerRegistry); | |
539 }; | |
540 | |
541 | |
542 // Class that extracts stack trace, used for profiling. | 508 // Class that extracts stack trace, used for profiling. |
543 class StackTracer : public AllStatic { | 509 class StackTracer : public AllStatic { |
544 public: | 510 public: |
545 static void Trace(Isolate* isolate, TickSample* sample); | 511 static void Trace(Isolate* isolate, TickSample* sample); |
546 }; | 512 }; |
547 | 513 |
548 } } // namespace v8::internal | 514 } } // namespace v8::internal |
549 | 515 |
550 | 516 |
551 #endif // V8_LOG_H_ | 517 #endif // V8_LOG_H_ |
OLD | NEW |