1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_SERVER_STATS_H_ 6 #define QUICHE_QUIC_PLATFORM_API_QUIC_SERVER_STATS_H_ 7 8 #include "net/quic/platform/impl/quic_server_stats_impl.h" 9 10 namespace quic { 11 12 //------------------------------------------------------------------------------ 13 // Enumeration histograms. 14 // 15 // Sample usage: 16 // // In Chrome, these values are persisted to logs. Entries should not be 17 // // renumbered and numeric values should never be reused. 18 // enum class MyEnum { 19 // FIRST_VALUE = 0, 20 // SECOND_VALUE = 1, 21 // ... 22 // FINAL_VALUE = N, 23 // COUNT 24 // }; 25 // QUIC_SERVER_HISTOGRAM_ENUM("My.Enumeration", MyEnum::SOME_VALUE, 26 // MyEnum::COUNT, "Number of time $foo equals to some enum value"); 27 // 28 // Note: The value in |sample| must be strictly less than |enum_size|. 29 30 #define QUIC_SERVER_HISTOGRAM_ENUM(name, sample, enum_size, docstring) \ 31 QUIC_SERVER_HISTOGRAM_ENUM_IMPL(name, sample, enum_size, docstring) 32 33 //------------------------------------------------------------------------------ 34 // Histogram for boolean values. 35 36 // Sample usage: 37 // QUIC_SERVER_HISTOGRAM_BOOL("My.Boolean", bool, 38 // "Number of times $foo is true or false"); 39 #define QUIC_SERVER_HISTOGRAM_BOOL(name, sample, docstring) \ 40 QUIC_SERVER_HISTOGRAM_BOOL_IMPL(name, sample, docstring) 41 42 //------------------------------------------------------------------------------ 43 // Timing histograms. These are used for collecting timing data (generally 44 // latencies). 45 46 // These macros create exponentially sized histograms (lengths of the bucket 47 // ranges exponentially increase as the sample range increases). The units for 48 // sample and max are unspecified, but they must be the same for one histogram. 49 50 // Sample usage: 51 // QUIC_SERVER_HISTOGRAM_TIMES("Very.Long.Timing.Histogram", time_delta, 52 // QuicTime::Delta::FromSeconds(1), QuicTime::Delta::FromSecond(3600 * 53 // 24), 100, "Time spent in doing operation."); 54 #define QUIC_SERVER_HISTOGRAM_TIMES(name, sample, min, max, bucket_count, \ 55 docstring) \ 56 QUIC_SERVER_HISTOGRAM_TIMES_IMPL(name, sample, min, max, bucket_count, \ 57 docstring) 58 59 //------------------------------------------------------------------------------ 60 // Count histograms. These are used for collecting numeric data. 61 62 // These macros default to exponential histograms - i.e. the lengths of the 63 // bucket ranges exponentially increase as the sample range increases. 64 65 // All of these macros must be called with |name| as a runtime constant. 66 67 // Any data outside the range here will be put in underflow and overflow 68 // buckets. Min values should be >=1 as emitted 0s will still go into the 69 // underflow bucket. 70 71 // Sample usage: 72 // QUIC_SERVER_SERVER_HISTOGRAM_CUSTOM_COUNTS("My.Histogram", 1, 100000000, 73 // 100, "Counters of hitting certian code."); 74 75 #define QUIC_SERVER_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count, \ 76 docstring) \ 77 QUIC_SERVER_HISTOGRAM_COUNTS_IMPL(name, sample, min, max, bucket_count, \ 78 docstring) 79 80 } // namespace quic 81 82 #endif // QUICHE_QUIC_PLATFORM_API_QUIC_SERVER_STATS_H_ 83