⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 service.c

📁 本程序为ST公司开发的源代码
💻 C
字号:
/**************************************************
 *
 * service.c
 *
 * CVS ID:   $Id: service.c,v 1.4 2006/09/18 09:55:23 belardi Exp $
 * Author:   Raffaele Belardi [RB] - STM
 * Date:     $Date: 2006/09/18 09:55:23 $
 * Revision: $Revision: 1.4 $
 * 
 * Description:
 * 
 * Service commands available through hostif
 * 
 ***************************************************
 * 
 * COPYRIGHT (C) ST Microelectronics  2005
 *            All Rights Reserved
 *
 ***************************************************
 *
 * STM CVS Log:
 *
 * $Log: service.c,v $ * Revision 1.4  2006/09/18 09:55:23  belardi * Corrected CVS keyword usage *
 * Revision 1.3  2006/09/18 09:24:13  belardi
 * Added Log CVS keyword into file header
 *
 *
 ***************************************************/
#include "configuration.h"
#include "accordoptypes.h"

#if (1==DEBUG_INCLUDE_MIPS_PROFILING)
#include "debug.h"
#include <stdio.h>
#include "osal.h"
#include "task_profiling.h"
#endif

#if (OS20_PROFILING == 1)
uint8 print_profiling = 0;
#endif

#if (1==DEBUG_INCLUDE_MIPS_PROFILING)

void Print_profiling(void)
{
  extern int8 *_OSAL_get_isr_name(int8 index);
  extern int8 *_OSAL_get_thread_name(int8 startupindex);
  int8 *pname;
  int8 i;
  uint32 duration;
  uint16 percent;
  STAT_PROF_t* pp;

  duration = Get_duration();
  printf("Profiling duration: %d ticks, %d ms\r\n", duration, duration / ticks_per_msec());
  if (duration)
  {
    printf("  i            name         ticks    #act   %%   us\r\n");
    printf("==================================================\r\n");
    for (i=0; i<19; i++)
    {
      pp = Get_task_address(i);
      if (pp->activations)
      {
        if (i > 0 && i <= OSAL_THREAD_LAST)
        {
          pname = _OSAL_get_thread_name(i-1);
        }
        else
        {
          pname = "";
        }
        percent = (uint16)(((float)pp->ticks * 1000) / duration);
        printf("%3d %15s %13d %7d %3d %4d\r\n", i, pname, pp->ticks, pp->activations, percent, (pp->ticks / pp->activations)/ticks_per_usec());
      }
    }
    printf("-\r\n");
    for (i=0; i<NR_OF_INT; i++)
    {
      pp = Get_int_address(i);
      if (pp->activations)
      {
        pname = _OSAL_get_isr_name(i);
        percent = (uint16)(((float)pp->ticks * 1000) / duration);
        printf("%3d %15s %13d %7d %3d %4d\r\n", i, pname, pp->ticks, pp->activations, percent, (pp->ticks / pp->activations)/ticks_per_usec());
      }
    }
  }
}
#endif // DEBUG_INCLUDE_MIPS_PROFILING

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -