| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  *  Copyright 2013 The WebRTC Project Authors. All rights reserved. |    2  *  Copyright 2013 The WebRTC Project Authors. All rights reserved. | 
|    3  * |    3  * | 
|    4  *  Use of this source code is governed by a BSD-style license |    4  *  Use of this source code is governed by a BSD-style license | 
|    5  *  that can be found in the LICENSE file in the root of the source |    5  *  that can be found in the LICENSE file in the root of the source | 
|    6  *  tree. An additional intellectual property rights grant can be found |    6  *  tree. An additional intellectual property rights grant can be found | 
|    7  *  in the file PATENTS.  All contributing project authors may |    7  *  in the file PATENTS.  All contributing project authors may | 
|    8  *  be found in the AUTHORS file in the root of the source tree. |    8  *  be found in the AUTHORS file in the root of the source tree. | 
|    9  */ |    9  */ | 
|   10  |   10  | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   48       event_count_(0) { |   48       event_count_(0) { | 
|   49 } |   49 } | 
|   50  |   50  | 
|   51 void ProfilerEvent::Start() { |   51 void ProfilerEvent::Start() { | 
|   52   if (start_count_ == 0) { |   52   if (start_count_ == 0) { | 
|   53     current_start_time_ = TimeNanos(); |   53     current_start_time_ = TimeNanos(); | 
|   54   } |   54   } | 
|   55   ++start_count_; |   55   ++start_count_; | 
|   56 } |   56 } | 
|   57  |   57  | 
|   58 void ProfilerEvent::Stop(uint64 stop_time) { |   58 void ProfilerEvent::Stop(uint64_t stop_time) { | 
|   59   --start_count_; |   59   --start_count_; | 
|   60   ASSERT(start_count_ >= 0); |   60   ASSERT(start_count_ >= 0); | 
|   61   if (start_count_ == 0) { |   61   if (start_count_ == 0) { | 
|   62     double elapsed = static_cast<double>(stop_time - current_start_time_) / |   62     double elapsed = static_cast<double>(stop_time - current_start_time_) / | 
|   63         kNumNanosecsPerSec; |   63         kNumNanosecsPerSec; | 
|   64     total_time_ += elapsed; |   64     total_time_ += elapsed; | 
|   65     if (event_count_ == 0) { |   65     if (event_count_ == 0) { | 
|   66       minimum_ = maximum_ = elapsed; |   66       minimum_ = maximum_ = elapsed; | 
|   67     } else { |   67     } else { | 
|   68       minimum_ = std::min(minimum_, elapsed); |   68       minimum_ = std::min(minimum_, elapsed); | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  107     ExclusiveScope scope(&lock_); |  107     ExclusiveScope scope(&lock_); | 
|  108     it = events_.insert( |  108     it = events_.insert( | 
|  109         EventMap::value_type(event_name, ProfilerEvent())).first; |  109         EventMap::value_type(event_name, ProfilerEvent())).first; | 
|  110   } |  110   } | 
|  111  |  111  | 
|  112   it->second.Start(); |  112   it->second.Start(); | 
|  113 } |  113 } | 
|  114  |  114  | 
|  115 void Profiler::StopEvent(const std::string& event_name) { |  115 void Profiler::StopEvent(const std::string& event_name) { | 
|  116   // Get the time ASAP, then wait for the lock. |  116   // Get the time ASAP, then wait for the lock. | 
|  117   uint64 stop_time = TimeNanos(); |  117   uint64_t stop_time = TimeNanos(); | 
|  118   SharedScope scope(&lock_); |  118   SharedScope scope(&lock_); | 
|  119   EventMap::iterator it = events_.find(event_name); |  119   EventMap::iterator it = events_.find(event_name); | 
|  120   if (it != events_.end()) { |  120   if (it != events_.end()) { | 
|  121     it->second.Stop(stop_time); |  121     it->second.Stop(stop_time); | 
|  122   } |  122   } | 
|  123 } |  123 } | 
|  124  |  124  | 
|  125 void Profiler::ReportToLog(const char* file, int line, |  125 void Profiler::ReportToLog(const char* file, int line, | 
|  126                            LoggingSeverity severity_to_use, |  126                            LoggingSeverity severity_to_use, | 
|  127                            const std::string& event_prefix) { |  127                            const std::string& event_prefix) { | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  183   stream << "count=" << profiler_event.event_count() |  183   stream << "count=" << profiler_event.event_count() | 
|  184          << " total=" << FormattedTime(profiler_event.total_time()) |  184          << " total=" << FormattedTime(profiler_event.total_time()) | 
|  185          << " mean=" << FormattedTime(profiler_event.mean()) |  185          << " mean=" << FormattedTime(profiler_event.mean()) | 
|  186          << " min=" << FormattedTime(profiler_event.minimum()) |  186          << " min=" << FormattedTime(profiler_event.minimum()) | 
|  187          << " max=" << FormattedTime(profiler_event.maximum()) |  187          << " max=" << FormattedTime(profiler_event.maximum()) | 
|  188          << " sd=" << profiler_event.standard_deviation(); |  188          << " sd=" << profiler_event.standard_deviation(); | 
|  189   return stream; |  189   return stream; | 
|  190 } |  190 } | 
|  191  |  191  | 
|  192 }  // namespace rtc |  192 }  // namespace rtc | 
| OLD | NEW |