view examples/instrument-test.c @ 1382:56b339272cd4

* include/net/if_gif.h include/net/if_sec.h include/net/zlib.h include/netinet/ip_ecn.h include/netinet6/ah.h include/netinet6/esp.h include/netinet6/esp_rijndael.h include/netinet6/esp_twofish.h include/netinet6/in6_gif.h include/netinet6/ipcomp.h include/netkey/key.h include/netkey/key_debug.h include/netkey/keysock.h src/sys/netkey src/sys/netinet/ip_ecn.c src/sys/netinet6/ah_core.c src/sys/netinet6/ah_input.c src/sys/netinet6/ah_output.c src/sys/netinet6/esp_core.c src/sys/netinet6/esp_input.c src/sys/netinet6/esp_output.c src/sys/netinet6/esp_rijndael.c src/sys/netinet6/esp_twofish.c src/sys/netinet6/in6_gif.c src/sys/netinet6/ipcomp_core.c src/sys/netinet6/ipcomp_input.c src/sys/netinet6/ipcomp_output.c src/sys/netinet6/ipsec.c: Added back the original KAME FreeBSD IPSEC files. * cdl/freebsd_net.cdl: CDl to control the compilation of IPSEC * include/sys/malloc.h: New memory type needed by IPSEC * include/sys/param.h: Name munging for IPSEC symbols * src/ecos/support.c: read_random_unlimited() should return the number of random bytes in the buffer. * src/sys/kern/kern_sysctl.c: Added missing copyright header. * src/sys/netinet/ip_output.c: Removed user() checks in IPSEC code. * src/sys/netinet6/ip6_output.c: Compiler warning fixes.
author asl
date Sat, 22 Nov 2003 12:59:20 +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;
}