sched_critmon: add thread run time to critmonitor

Change-Id: Ib44e45f0f9a1b249b4067db324c9dbdf0cf3f288
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd
2021-05-07 17:55:24 +08:00
committed by Xiang Xiao
parent dbdb24e2e0
commit 2d32a52353
3 changed files with 57 additions and 11 deletions
+35 -2
View File
@@ -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;