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

Side by Side Diff: src/log.cc

Issue 23690003: Revert "Add Chromium-style TimeDelta, Time and TimeTicks classes, and a new ElapsedTimer class." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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/optimizing-compiler-thread.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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 : isolate_(isolate), 709 : isolate_(isolate),
710 ticker_(NULL), 710 ticker_(NULL),
711 profiler_(NULL), 711 profiler_(NULL),
712 log_events_(NULL), 712 log_events_(NULL),
713 logging_nesting_(0), 713 logging_nesting_(0),
714 cpu_profiler_nesting_(0), 714 cpu_profiler_nesting_(0),
715 log_(new Log(this)), 715 log_(new Log(this)),
716 ll_logger_(NULL), 716 ll_logger_(NULL),
717 jit_logger_(NULL), 717 jit_logger_(NULL),
718 listeners_(5), 718 listeners_(5),
719 is_initialized_(false) { 719 is_initialized_(false),
720 epoch_(0) {
720 } 721 }
721 722
722 723
723 Logger::~Logger() { 724 Logger::~Logger() {
724 delete log_; 725 delete log_;
725 } 726 }
726 727
727 728
728 void Logger::addCodeEventListener(CodeEventListener* listener) { 729 void Logger::addCodeEventListener(CodeEventListener* listener) {
729 ASSERT(!hasCodeEventListener(listener)); 730 ASSERT(!hasCodeEventListener(listener));
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 start, 861 start,
861 end); 862 end);
862 msg.WriteToLogFile(); 863 msg.WriteToLogFile();
863 } 864 }
864 865
865 866
866 void Logger::CodeDeoptEvent(Code* code) { 867 void Logger::CodeDeoptEvent(Code* code) {
867 if (!log_->IsEnabled()) return; 868 if (!log_->IsEnabled()) return;
868 ASSERT(FLAG_log_internal_timer_events); 869 ASSERT(FLAG_log_internal_timer_events);
869 Log::MessageBuilder msg(log_); 870 Log::MessageBuilder msg(log_);
870 int since_epoch = static_cast<int>(timer_.Elapsed().InMicroseconds()); 871 int since_epoch = static_cast<int>(OS::Ticks() - epoch_);
871 msg.Append("code-deopt,%ld,%d\n", since_epoch, code->CodeSize()); 872 msg.Append("code-deopt,%ld,%d\n", since_epoch, code->CodeSize());
872 msg.WriteToLogFile(); 873 msg.WriteToLogFile();
873 } 874 }
874 875
875 876
876 void Logger::TimerEvent(StartEnd se, const char* name) { 877 void Logger::TimerEvent(StartEnd se, const char* name) {
877 if (!log_->IsEnabled()) return; 878 if (!log_->IsEnabled()) return;
878 ASSERT(FLAG_log_internal_timer_events); 879 ASSERT(FLAG_log_internal_timer_events);
879 Log::MessageBuilder msg(log_); 880 Log::MessageBuilder msg(log_);
880 int since_epoch = static_cast<int>(timer_.Elapsed().InMicroseconds()); 881 int since_epoch = static_cast<int>(OS::Ticks() - epoch_);
881 const char* format = (se == START) ? "timer-event-start,\"%s\",%ld\n" 882 const char* format = (se == START) ? "timer-event-start,\"%s\",%ld\n"
882 : "timer-event-end,\"%s\",%ld\n"; 883 : "timer-event-end,\"%s\",%ld\n";
883 msg.Append(format, name, since_epoch); 884 msg.Append(format, name, since_epoch);
884 msg.WriteToLogFile(); 885 msg.WriteToLogFile();
885 } 886 }
886 887
887 888
888 void Logger::EnterExternal(Isolate* isolate) { 889 void Logger::EnterExternal(Isolate* isolate) {
889 LOG(isolate, TimerEvent(START, TimerEventScope::v8_external)); 890 LOG(isolate, TimerEvent(START, TimerEventScope::v8_external));
890 ASSERT(isolate->current_vm_state() == JS); 891 ASSERT(isolate->current_vm_state() == JS);
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 DeleteArray(parameter_string); 1494 DeleteArray(parameter_string);
1494 msg.WriteToLogFile(); 1495 msg.WriteToLogFile();
1495 } 1496 }
1496 1497
1497 1498
1498 void Logger::TickEvent(TickSample* sample, bool overflow) { 1499 void Logger::TickEvent(TickSample* sample, bool overflow) {
1499 if (!log_->IsEnabled() || !FLAG_prof) return; 1500 if (!log_->IsEnabled() || !FLAG_prof) return;
1500 Log::MessageBuilder msg(log_); 1501 Log::MessageBuilder msg(log_);
1501 msg.Append("%s,", kLogEventsNames[TICK_EVENT]); 1502 msg.Append("%s,", kLogEventsNames[TICK_EVENT]);
1502 msg.AppendAddress(sample->pc); 1503 msg.AppendAddress(sample->pc);
1503 msg.Append(",%ld", static_cast<int>(timer_.Elapsed().InMicroseconds())); 1504 msg.Append(",%ld", static_cast<int>(OS::Ticks() - epoch_));
1504 if (sample->has_external_callback) { 1505 if (sample->has_external_callback) {
1505 msg.Append(",1,"); 1506 msg.Append(",1,");
1506 msg.AppendAddress(sample->external_callback); 1507 msg.AppendAddress(sample->external_callback);
1507 } else { 1508 } else {
1508 msg.Append(",0,"); 1509 msg.Append(",0,");
1509 msg.AppendAddress(sample->tos); 1510 msg.AppendAddress(sample->tos);
1510 } 1511 }
1511 msg.Append(",%d", static_cast<int>(sample->state)); 1512 msg.Append(",%d", static_cast<int>(sample->state));
1512 if (overflow) { 1513 if (overflow) {
1513 msg.Append(",overflow"); 1514 msg.Append(",overflow");
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 if (FLAG_prof) { 1889 if (FLAG_prof) {
1889 profiler_ = new Profiler(isolate); 1890 profiler_ = new Profiler(isolate);
1890 if (FLAG_prof_lazy) { 1891 if (FLAG_prof_lazy) {
1891 profiler_->pause(); 1892 profiler_->pause();
1892 } else { 1893 } else {
1893 logging_nesting_ = 1; 1894 logging_nesting_ = 1;
1894 profiler_->Engage(); 1895 profiler_->Engage();
1895 } 1896 }
1896 } 1897 }
1897 1898
1898 if (FLAG_log_internal_timer_events || FLAG_prof) timer_.Start(); 1899 if (FLAG_log_internal_timer_events || FLAG_prof) epoch_ = OS::Ticks();
1899 1900
1900 return true; 1901 return true;
1901 } 1902 }
1902 1903
1903 1904
1904 void Logger::SetCodeEventHandler(uint32_t options, 1905 void Logger::SetCodeEventHandler(uint32_t options,
1905 JitCodeEventHandler event_handler) { 1906 JitCodeEventHandler event_handler) {
1906 if (jit_logger_) { 1907 if (jit_logger_) {
1907 removeCodeEventListener(jit_logger_); 1908 removeCodeEventListener(jit_logger_);
1908 delete jit_logger_; 1909 delete jit_logger_;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 if (jit_logger_) { 1950 if (jit_logger_) {
1950 removeCodeEventListener(jit_logger_); 1951 removeCodeEventListener(jit_logger_);
1951 delete jit_logger_; 1952 delete jit_logger_;
1952 jit_logger_ = NULL; 1953 jit_logger_ = NULL;
1953 } 1954 }
1954 1955
1955 return log_->Close(); 1956 return log_->Close();
1956 } 1957 }
1957 1958
1958 } } // namespace v8::internal 1959 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log.h ('k') | src/optimizing-compiler-thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698