File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 1
1
text data bss dec hex filename
2
- 193480 57252 507021 757753 b8ff9 build/template.elf
2
+ 193528 57252 507029 757809 b9031 build/template.elf
Original file line number Diff line number Diff line change 4
4
* SPDX-License-Identifier: MIT
5
5
*/
6
6
7
- #include "libmcu/board.h"
8
-
7
+ #include "esp_timer.h"
9
8
#include "freertos/FreeRTOS.h"
10
9
#include "freertos/task.h"
11
10
@@ -20,15 +19,15 @@ static struct cpuload {
20
19
21
20
void on_task_switch_in (void )
22
21
{
23
- static uint32_t t0 ;
24
- static uint32_t sum_elapsed ;
22
+ static uint64_t t0 ;
23
+ static uint64_t sum_elapsed ;
25
24
26
- uint32_t t1 = board_get_time_since_boot_ms ();
25
+ uint64_t t1 = esp_timer_get_time (); /* in microseconds */
27
26
uint32_t elapsed = t1 - t0 ;
28
27
29
28
/* NOTE: count at least 1 even if the task has run for much shorter time
30
- * as millisecond unit timer used here. For fine granularity, introduce
31
- * high-resolution timer. */
29
+ * as microsecond unit timer used here. For fine granularity, introduce
30
+ * more high-resolution timer. */
32
31
if (elapsed == 0 ) {
33
32
elapsed = 1 ;
34
33
}
You can’t perform that action at this time.
0 commit comments