| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 2 * Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 3 * Distributed under the terms of the GNU General Public License v2 | 3 * Distributed under the terms of the GNU General Public License v2 |
| 4 */ | 4 */ |
| 5 #ifndef _TICKCOUNTER_H | 5 #ifndef _TICKCOUNTER_H_ |
| 6 #define _TICKCOUNTER_H 1 | 6 #define _TICKCOUNTER_H_ 1 |
| 7 | 7 |
| 8 enum { WHEEL_SIZE = 60 }; | 8 enum { WHEEL_SIZE = 60 }; |
| 9 | 9 |
| 10 typedef struct Avg_s { | 10 typedef struct Avg_s { |
| 11 u32 avg; | 11 u32 avg; |
| 12 u32 peak; | 12 u32 peak; |
| 13 } Avg_s; | 13 } Avg_s; |
| 14 | 14 |
| 15 typedef struct TickCounter_s { | 15 typedef struct TickCounter_s { |
| 16 u32 tick_size; /* Must be factor of WHEEL_SIZE */ | 16 u32 tick_size; /* Must be factor of WHEEL_SIZE */ |
| 17 u32 ticks_per_wheel; | 17 u32 ticks_per_wheel; |
| 18 u32 hour_wrapped; | 18 u32 hour_wrapped; |
| 19 u8 itick; | 19 u8 itick; |
| 20 u8 iminute; | 20 u8 iminute; |
| 21 u8 ihour; | 21 u8 ihour; |
| 22 u32 tick[WHEEL_SIZE]; | 22 u32 tick[WHEEL_SIZE]; |
| 23 Avg_s minute[WHEEL_SIZE]; | 23 Avg_s minute[WHEEL_SIZE]; |
| 24 Avg_s hour[WHEEL_SIZE]; | 24 Avg_s hour[WHEEL_SIZE]; |
| 25 } TickCounter_s; | 25 } TickCounter_s; |
| 26 | 26 |
| 27 void tick(TickCounter_s *counter, u32 n); | 27 void tick(TickCounter_s *counter, u32 n); |
| 28 bool init_counter(TickCounter_s *counter, u32 tick); | 28 bool init_counter(TickCounter_s *counter, u32 tick); |
| 29 | 29 |
| 30 #endif | 30 #endif |
| OLD | NEW |