mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
driver/note: To support clock_gettime for CPU sleep scenario
Signed-off-by: Majingyun <majingyun@lixiang.com>
This commit is contained in:
parent
50c0e13a29
commit
a06a75e50c
3 changed files with 33 additions and 0 deletions
|
|
@ -36,6 +36,19 @@ config DRIVERS_NOTECTL
|
|||
If this option is selected, the instrumentation filter control device
|
||||
/dev/notectl is provided.
|
||||
|
||||
config NOTE_GET_PERF_TIME
|
||||
bool "Note get time config"
|
||||
default y
|
||||
---help---
|
||||
If this option is selected, then note get time from perf time
|
||||
|
||||
config NOTE_GET_CLOCK_TIME
|
||||
bool "Note get time config"
|
||||
default n
|
||||
depends on !NOTE_GET_PERF_TIME
|
||||
---help---
|
||||
If this option is selected, then note get time from clock time
|
||||
|
||||
config DRIVERS_NOTERAM
|
||||
bool "Note RAM driver"
|
||||
default y
|
||||
|
|
|
|||
|
|
@ -217,7 +217,17 @@ static void note_common(FAR struct tcb_s *tcb,
|
|||
note->nc_pid = tcb->pid;
|
||||
}
|
||||
|
||||
#if defined (CONFIG_NOTE_GET_PERF_TIME)
|
||||
note->nc_systime = perf_gettime();
|
||||
|
||||
#elif defined (CONFIG_NOTE_GET_CLOCK_TIME)
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
note->nc_systime = ts.tv_sec * NSEC_PER_SEC + ts.tv_nsec;
|
||||
|
||||
#else
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
|||
|
|
@ -794,7 +794,17 @@ static int noteram_dump_header(FAR struct lib_outstream_s *s,
|
|||
pid_t pid;
|
||||
int ret;
|
||||
|
||||
|
||||
#if defined (CONFIG_NOTE_GET_PERF_TIME)
|
||||
perf_convert(note->nc_systime, &ts);
|
||||
|
||||
#elif defined (CONFIG_NOTE_GET_CLOCK_TIME)
|
||||
ts.tv_sec = note->nc_systime / NSEC_PER_SEC;
|
||||
ts.tv_nsec = note->nc_systime % NSEC_PER_SEC;
|
||||
|
||||
#else
|
||||
#endif
|
||||
|
||||
pid = note->nc_pid;
|
||||
#ifdef CONFIG_SMP
|
||||
int cpu = note->nc_cpu;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue