Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1518 → Rev 1568

/demos/trunk/newtrace/udp/udptrace.c
7,6 → 7,7
*
* Authors :
* Giacomo Guidi <giacomo@gandalf.sssup.it>
* Tullio Facchinetti <tullio.facchinetti@unipv.it>
*
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
*
13,6 → 14,7
* http://www.sssup.it
* http://retis.sssup.it
* http://shark.sssup.it
* http://robot.unipv.it
*/
 
#include <kernel/kern.h>
31,6 → 33,7
struct timespec start,end,diff;
SYS_FLAGS f;
 
/** Create 3 chunks for storing the tracer events. */
a = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC);
b = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_JTN);
c = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC);
38,10 → 41,16
FTrace_chunk_link(a,b);
FTrace_chunk_link(b,c);
 
/** Select the first chunk for saving the events. */
FTrace_actual_chunk_select(a);
 
kern_gettime(&start);
/** Start the tracer. */
FTrace_enable();
/** Disable the filtering for timer related events. */
FTrace_set_filter(FTrace_filter_timer, 1);
 
TRACER_LOGEVENT(FTrace_EVT_trace_start,proc_table[exec_shadow].context,clk_per_msec);
 
50,7 → 59,11
(unsigned short int)proc_table[i].context,i);
 
for (i=0;i<1000000000;i++);
/** Enable the filtering for timer related events. */
FTrace_set_filter(FTrace_filter_timer, 0);
/** Change the chunk where the events are stored. */
TRACER_LOGEVENT(FTrace_EVT_next_chunk,0,0);
f = kern_fsave();
67,8 → 80,10
for (i=0;i<1000000000;i++);
 
/** Store a TFrace stop event. */
TRACER_LOGEVENT(FTrace_EVT_trace_stop,0,0);
 
/** Stop the tracer. */
FTrace_disable();
kern_gettime(&end);
 
76,8 → 91,18
 
cprintf("Logged Time %d s %d us\n",(int)diff.tv_sec,(int)diff.tv_nsec/1000);
 
/** Initialize the network for remotely saving the trace. */
FTrace_OSD_init_udp(1, "192.168.1.10", "192.168.1.1");
/**
* You may want to save the events to disk. In that case, simply change
* the network initialization instruction with the following line:
*
* FTrace_init_disk_writer("trace.dat", 0, NULL, NULL);
*
*/
 
/** Save the chunk. */
FTrace_send_chunk(a, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC);
FTrace_send_chunk(b, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_JTN);