OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Use trace_analyzer::Query and trace_analyzer::TraceAnalyzer to search for | 5 // Use trace_analyzer::Query and trace_analyzer::TraceAnalyzer to search for |
6 // specific trace events that were generated by the trace_event.h API. | 6 // specific trace events that were generated by the trace_event.h API. |
7 // | 7 // |
8 // Basic procedure: | 8 // Basic procedure: |
9 // - Get trace events JSON string from base::debug::TraceLog. | 9 // - Get trace events JSON string from base::debug::TraceLog. |
10 // - Create TraceAnalyzer with JSON string. | 10 // - Create TraceAnalyzer with JSON string. |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 | 546 |
547 // Utility functions for TraceEventVector. | 547 // Utility functions for TraceEventVector. |
548 | 548 |
549 struct RateStats { | 549 struct RateStats { |
550 double min_us; | 550 double min_us; |
551 double max_us; | 551 double max_us; |
552 double mean_us; | 552 double mean_us; |
553 double standard_deviation_us; | 553 double standard_deviation_us; |
554 }; | 554 }; |
555 | 555 |
| 556 struct RateStatsOptions { |
| 557 RateStatsOptions() : trim_min(0u), trim_max(0u) {} |
| 558 // After the times between events are sorted, the number of specified elements |
| 559 // will be trimmed before calculating the RateStats. This is useful in cases |
| 560 // where extreme outliers are tolerable and should not skew the overall |
| 561 // average. |
| 562 size_t trim_min; // Trim this many minimum times. |
| 563 size_t trim_max; // Trim this many maximum times. |
| 564 }; |
| 565 |
556 // Calculate min/max/mean and standard deviation from the times between | 566 // Calculate min/max/mean and standard deviation from the times between |
557 // adjacent events. | 567 // adjacent events. |
558 bool GetRateStats(const TraceEventVector& events, RateStats* stats); | 568 bool GetRateStats(const TraceEventVector& events, |
| 569 RateStats* stats, |
| 570 const RateStatsOptions* options); |
559 | 571 |
560 // Starting from |position|, find the first event that matches |query|. | 572 // Starting from |position|, find the first event that matches |query|. |
561 // Returns true if found, false otherwise. | 573 // Returns true if found, false otherwise. |
562 bool FindFirstOf(const TraceEventVector& events, | 574 bool FindFirstOf(const TraceEventVector& events, |
563 const Query& query, | 575 const Query& query, |
564 size_t position, | 576 size_t position, |
565 size_t* return_index); | 577 size_t* return_index); |
566 | 578 |
567 // Starting from |position|, find the last event that matches |query|. | 579 // Starting from |position|, find the last event that matches |query|. |
568 // Returns true if found, false otherwise. | 580 // Returns true if found, false otherwise. |
(...skipping 21 matching lines...) Expand all Loading... |
590 | 602 |
591 // Count all matches. | 603 // Count all matches. |
592 static inline size_t CountMatches(const TraceEventVector& events, | 604 static inline size_t CountMatches(const TraceEventVector& events, |
593 const Query& query) { | 605 const Query& query) { |
594 return CountMatches(events, query, 0u, events.size()); | 606 return CountMatches(events, query, 0u, events.size()); |
595 } | 607 } |
596 | 608 |
597 } // namespace trace_analyzer | 609 } // namespace trace_analyzer |
598 | 610 |
599 #endif // BASE_TEST_TRACE_EVENT_ANALYZER_H_ | 611 #endif // BASE_TEST_TRACE_EVENT_ANALYZER_H_ |
OLD | NEW |