aboutsummaryrefslogtreecommitdiffstats
path: root/src/stdump.c
blob: 282fb31ea01f57da6d21a971e310cb87bbf53878 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


#include "litmus.h"
#include "adaptive.h"
#include "sched_trace.h"

int show_sl_chg(trace_header_t* hdr)
{
	service_level_change_record_t *rec;

	rec = (service_level_change_record_t*) hdr;
	printf("SL CHANGE : PID=%d PERIOD=%lu\n", rec->task.pid, 
	       rec->new_level.period);
	return 0;
}

int show_weight_error(trace_header_t* hdr)
{
	weight_error_record_t *rec;

	rec = (weight_error_record_t*) hdr;
	printf("WEIGHT ERR: PID=%d EST=%5.4f ACT=%5.4f\n", rec->task, 
	       fp2f(rec->estimate), fp2f(rec->actual));
	return 0;
}


int main(int argc, char** argv)
{
	record_callback_t cb;
	int ret;
	
	init_record_callback(&cb);
	set_callback(ST_SERVICE_LEVEL_CHANGE, show_sl_chg, &cb);
	set_callback(ST_WEIGHT_ERROR, show_weight_error, &cb);	
	
	ret = walk_sched_trace_files_ordered(argv + 1, argc - 1, 0, &cb);
	if (ret != 0)
		perror("walk failed");
	return 0;
}