📄 dm_perf.c
字号:
/*----------------------------------------------------------------------
* Copyright (C) 2000 Intel Corp.
*
* This file contains the performance counter functions.
*/
#include <string.h>
#include <stdio.h>
#include "systypes.h"
#include "dm_perf.h"
/*----------------------------------------------------------------------
*
*/
void DM_PerfCount (DM_Perf_T *p, unsigned delta)
{
p->count++;
p->total += delta;
if (delta < p->min)
{
p->min = delta;
p->minCount = p->count;
}
if (delta > p->max)
{
p->max = delta;
p->maxCount = p->count;
}
}
/*----------------------------------------------------------------------
*
*/
void DM_PerfInit (DM_Perf_T *p)
{
p->count = 0;
p->total = 0;
p->min = 0xffffffff;
p->max = 0;
}
/*----------------------------------------------------------------------
*
*/
void DM_PerfDisplay (DM_Perf_T *p, char *tag, unsigned timebase)
{
printf ("%s total %d (min@%d,max@%d)", tag,
p->count, p->minCount, p->maxCount);
if (p->count && timebase)
{
unsigned ticks = p->total / p->count;
printf ("%s avg %d ticks, %3.2fus", tag,
ticks,
((float) ticks / timebase) * 1000000);
printf ("%s min %d ticks, %3.2fus", tag,
p->min,
((float) p->min / timebase) * 1000000);
printf ("%s max %d ticks, %3.2fus", tag,
p->max,
((float) p->max / timebase) * 1000000);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -