/src/trafficserver/include/tscore/FrequencyCounter.h
Line | Count | Source |
1 | | /** @file |
2 | | |
3 | | FrequencyCounter |
4 | | |
5 | | @section license License |
6 | | |
7 | | Licensed to the Apache Software Foundation (ASF) under one |
8 | | or more contributor license agreements. See the NOTICE file |
9 | | distributed with this work for additional information |
10 | | regarding copyright ownership. The ASF licenses this file |
11 | | to you under the Apache License, Version 2.0 (the |
12 | | "License"); you may not use this file except in compliance |
13 | | with the License. You may obtain a copy of the License at |
14 | | |
15 | | http://www.apache.org/licenses/LICENSE-2.0 |
16 | | |
17 | | Unless required by applicable law or agreed to in writing, software |
18 | | distributed under the License is distributed on an "AS IS" BASIS, |
19 | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
20 | | See the License for the specific language governing permissions and |
21 | | limitations under the License. |
22 | | */ |
23 | | |
24 | | #pragma once |
25 | | |
26 | | #include <cstdint> |
27 | | #include <tscore/ink_hrtime.h> |
28 | | |
29 | | class FrequencyCounter |
30 | | { |
31 | | public: |
32 | | void increment(uint16_t amount = 1); |
33 | | uint32_t get_count(); |
34 | 0 | virtual ~FrequencyCounter() {} |
35 | | |
36 | | protected: |
37 | | uint16_t _count[2] = {0}; |
38 | | ink_hrtime _last_update = 0; |
39 | | |
40 | | private: |
41 | | virtual ink_hrtime _ink_get_hrtime(); |
42 | | }; |