Skip to content

Commit c018be6

Browse files
Gary-Hobsonxiaoxiang781216
authored andcommitted
note: merge nc_systime_nsec and sec
Signed-off-by: yinshengkai <[email protected]>
1 parent 0be1196 commit c018be6

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

drivers/note/note_driver.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,6 @@ static void note_common(FAR struct tcb_s *tcb,
224224
FAR struct note_common_s *note,
225225
uint8_t length, uint8_t type)
226226
{
227-
struct timespec ts;
228-
perf_convert(perf_gettime(), &ts);
229-
230227
/* Save all of the common fields */
231228

232229
note->nc_length = length;
@@ -244,8 +241,7 @@ static void note_common(FAR struct tcb_s *tcb,
244241
note->nc_pid = tcb->pid;
245242
}
246243

247-
note->nc_systime_sec = ts.tv_sec;
248-
note->nc_systime_nsec = ts.tv_nsec;
244+
note->nc_systime = perf_gettime();
249245
}
250246

251247
/****************************************************************************

drivers/note/noteram_driver.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -649,11 +649,11 @@ static int noteram_dump_header(FAR struct lib_outstream_s *s,
649649
FAR struct note_common_s *note,
650650
FAR struct noteram_dump_context_s *ctx)
651651
{
652+
struct timespec ts;
652653
pid_t pid;
653-
long nsec = note->nc_systime_nsec;
654-
time_t sec = note->nc_systime_sec;
655654
int ret;
656655

656+
perf_convert(note->nc_systime, &ts);
657657
pid = note->nc_pid;
658658
#ifdef CONFIG_SMP
659659
int cpu = note->nc_cpu;
@@ -663,7 +663,7 @@ static int noteram_dump_header(FAR struct lib_outstream_s *s,
663663

664664
ret = lib_sprintf(s, "%8s-%-3u [%d] %3" PRIu64 ".%09lu: ",
665665
get_taskname(pid), get_pid(pid), cpu,
666-
(uint64_t)sec, nsec);
666+
(uint64_t)ts.tv_sec, ts.tv_nsec);
667667

668668
return ret;
669669
}

include/nuttx/sched_note.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -320,15 +320,8 @@ struct note_common_s
320320
uint8_t nc_type; /* See enum note_type_e */
321321
uint8_t nc_priority; /* Thread/task priority */
322322
uint8_t nc_cpu; /* CPU thread/task running on */
323-
pid_t nc_pid; /* ID of the thread/task */
324-
325-
/* Time when note was buffered (sec) */
326-
327-
time_t nc_systime_sec;
328-
329-
/* Time when note was buffered (nsec) */
330-
331-
long nc_systime_nsec;
323+
pid_t nc_pid; /* ID of the thread/task */
324+
clock_t nc_systime; /* Time when note was buffered */
332325
};
333326

334327
/* This is the specific form of the NOTE_START note */

0 commit comments

Comments
 (0)