view examples/instrument-test.c @ 1423:440ddbf97b39

2003-09-21 Jonathan Larmour <jifl@eCosCentric.com> * cdl/hal_sh.cdl: CYGHWR_HAL_SH_FPU_REGS is only needed if there's an FPU. * include/hal_var_bank.h (HAL_THREAD_INIT_CONTEXT_FPU): Use FPSCR init value from HAL register definitions. 2003-09-19 John Dallaway <jld@ecoscentric.com> * cdl/hal_sh.cdl: Specify default CDL values for sh4_202_md target. 2003-09-11 Nick Garnett <nickg@ecoscentric.com> * include/hal_var_bank.h (HAL_THREAD_INIT_CONTEXT_FPU): Changed initial value of fpscr to do round-to-nearest rather than round-to-zero. 2003-09-08 Nick Garnett <nickg@ecoscentric.com> * src/vectors.S (cyg_hal_default_exception_vsr): Added code to switch to interrupt stack when fielding exceptions from RedBoot or some other ROM monitor. Without this we get potential stack overflows when debugging via the network. 2003-09-05 Nick Garnett <nickg@ecoscentric.com> * include/hal_arch.h: * include/hal_var_bank.h: * include/hal_var_bank.inc: * src/context.S: Added support for floating point state save and restore and GDB * src/hal_misc.c (hal_delay_us): Fixed implementation of this routine so that it actually works. * src/hal_syscall.c: Added support for all supportable syscalls. * src/sh_stub.c: Added check in __is_bsp_syscall() for trap 34 traps using the TRA register. * src/vectors.S: Set startup stack size to the same as the interrupt stack size. In some configurations of RedBoot the previous value was too small. * include/sh_stub.h: Fixed HAL_STUB_PLATFORM_STUBS_FIXUP() to only rewind for a breakpoint. Traps are not rewound. * cdl/hal_sh.cdl: Added option for SH architecture FP register count.
author nickg
date Fri, 05 Dec 2003 17:06:23 +0000
parents ead06911cbae
children
line wrap: on
line source

/* this is a program which uses eCos instrumentation buffers; it needs
   to be linked with a kernel which was compiled with support for
   instrumentation */

#include <stdio.h>
#include <pkgconf/kernel.h>
#include <cyg/kernel/instrmnt.h>
#include <cyg/kernel/kapi.h>

#ifndef CYGVAR_KERNEL_INSTRUMENT_EXTERNAL_BUFFER
# error You must configure eCos with CYGVAR_KERNEL_INSTRUMENT_EXTERNAL_BUFFER
#endif

struct Instrument_Record
{
    CYG_WORD16  type;                   // record type
    CYG_WORD16  thread;                 // current thread id
    CYG_WORD    timestamp;              // 32 bit timestamp
    CYG_WORD    arg1;                   // first arg
    CYG_WORD    arg2;                   // second arg
};

struct Instrument_Record instrument_buffer[20];
cyg_uint32        instrument_buffer_size = 20;

int main(void)
{
  int i;

  cyg_instrument_enable(CYG_INSTRUMENT_CLASS_CLOCK, 0);
  cyg_instrument_enable(CYG_INSTRUMENT_CLASS_THREAD, 0);
  cyg_instrument_enable(CYG_INSTRUMENT_CLASS_ALARM, 0);

  printf("Program to play with instrumentation buffer\n");

  cyg_thread_delay(2);

  cyg_instrument_disable(CYG_INSTRUMENT_CLASS_CLOCK, 0);
  cyg_instrument_disable(CYG_INSTRUMENT_CLASS_THREAD, 0);
  cyg_instrument_disable(CYG_INSTRUMENT_CLASS_ALARM, 0);

  for (i = 0; i < instrument_buffer_size; ++i) {
    printf("Record %02d: type 0x%04x, thread %d, ",
	   i, instrument_buffer[i].type, instrument_buffer[i].thread);
    printf("time %5d, arg1 0x%08x, arg2 0x%08x\n",
	   instrument_buffer[i].timestamp, instrument_buffer[i].arg1,
	   instrument_buffer[i].arg2);
  }
  return 0;
}