mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 05:16:47 +08:00
sched_critmon: add thread run time to critmonitor
Change-Id: Ib44e45f0f9a1b249b4067db324c9dbdf0cf3f288 Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
@@ -802,7 +802,7 @@ static ssize_t proc_critmon(FAR struct proc_file_s *procfile,
|
||||
linesize = procfs_snprintf(procfile->line, STATUS_LINELEN, "%lu.%09lu,",
|
||||
(unsigned long)maxtime.tv_sec,
|
||||
(unsigned long)maxtime.tv_nsec);
|
||||
copysize = procfs_memcpy(procfile->line, linesize, buffer, buflen,
|
||||
copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining,
|
||||
&offset);
|
||||
|
||||
totalsize += copysize;
|
||||
@@ -832,10 +832,43 @@ static ssize_t proc_critmon(FAR struct proc_file_s *procfile,
|
||||
|
||||
/* Generate output for maximum time in a critical section */
|
||||
|
||||
linesize = procfs_snprintf(procfile->line, STATUS_LINELEN, "%lu.%09lu,",
|
||||
(unsigned long)maxtime.tv_sec,
|
||||
(unsigned long)maxtime.tv_nsec);
|
||||
copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining,
|
||||
&offset);
|
||||
|
||||
totalsize += copysize;
|
||||
buffer += copysize;
|
||||
remaining -= copysize;
|
||||
|
||||
if (totalsize >= buflen)
|
||||
{
|
||||
return totalsize;
|
||||
}
|
||||
|
||||
/* Convert and generate output for maximum time thread running */
|
||||
|
||||
if (tcb->run_max > 0)
|
||||
{
|
||||
up_critmon_convert(tcb->run_max, &maxtime);
|
||||
}
|
||||
else
|
||||
{
|
||||
maxtime.tv_sec = 0;
|
||||
maxtime.tv_nsec = 0;
|
||||
}
|
||||
|
||||
/* Reset the maximum */
|
||||
|
||||
tcb->run_max = 0;
|
||||
|
||||
/* Generate output for maximum time thread running */
|
||||
|
||||
linesize = procfs_snprintf(procfile->line, STATUS_LINELEN, "%lu.%09lu\n",
|
||||
(unsigned long)maxtime.tv_sec,
|
||||
(unsigned long)maxtime.tv_nsec);
|
||||
copysize = procfs_memcpy(procfile->line, linesize, buffer, buflen,
|
||||
copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining,
|
||||
&offset);
|
||||
|
||||
totalsize += copysize;
|
||||
|
||||
Reference in New Issue
Block a user