4 open(PROFILE,"profile.h") || die "Unable to open profile.h\n";
8 open(METRICS,"> metrics.h") || die "Unable to open metrics.h for output\n";
10 print METRICS "#define COUNT_TIME_INDOM 0\n";
11 print METRICS "#define BYTE_INDOM 1\n\n";
12 print METRICS "#define FIELD_OFF(x) (unsigned)\&(((struct profile_stats *)NULL)->x)\n\n";
13 print METRICS "typedef struct {\n";
14 print METRICS "\tchar *name;\n";
15 print METRICS "\tunsigned offset;\n";
16 print METRICS "} samba_instance;\n\n";
18 @instnames = grep(/unsigned .*_time;/,@profile);
19 foreach $instnames (@instnames) {
21 $instnames =~ s/^.*unsigned (.*)_time.*$/$1/;
24 print METRICS "static samba_instance samba_counts[] = {";
26 foreach $1 (@instnames) {
33 print METRICS "\t{\"$1\", FIELD_OFF($1_count)}";
35 print METRICS "\n};\n\n";
36 print METRICS "static samba_instance samba_times[] = {";
38 foreach $1 (@instnames) {
45 print METRICS "\t{\"$1\", FIELD_OFF($1_time)}";
47 print METRICS "\n};\n\n";
48 print METRICS "static samba_instance samba_bytes[] = {";
49 @instnames = grep(/unsigned .*_bytes;/,@profile);
51 foreach $_ (@instnames) {
58 /^.*unsigned (.*)_bytes.*$/;
59 print METRICS "\t{\"$1\", FIELD_OFF($1_bytes)}";
61 print METRICS "\n};\n";