diff options
author | Herb Lewis <herb@samba.org> | 2000-11-09 20:45:09 +0000 |
---|---|---|
committer | Herb Lewis <herb@samba.org> | 2000-11-09 20:45:09 +0000 |
commit | be6a3173458b3112e9b4d99d078895633fb80c60 (patch) | |
tree | 819139fd575e2bb522b16e56defcd367bbf474d0 /pcp/mkheader.pl | |
parent | 3adc0e7a4ee71d255d2181a928d6e632664b7f4c (diff) | |
download | samba-be6a3173458b3112e9b4d99d078895633fb80c60.tar.gz samba-be6a3173458b3112e9b4d99d078895633fb80c60.tar.bz2 samba-be6a3173458b3112e9b4d99d078895633fb80c60.zip |
restructure PCP metrics (merge from 2.2 branch)
(This used to be commit dc725c2256ff5f3d8ac37fe33cfa1685194f7f46)
Diffstat (limited to 'pcp/mkheader.pl')
-rwxr-xr-x | pcp/mkheader.pl | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/pcp/mkheader.pl b/pcp/mkheader.pl new file mode 100755 index 0000000000..ad069c544a --- /dev/null +++ b/pcp/mkheader.pl @@ -0,0 +1,63 @@ +#!/usr/bin/perl + + +open(PROFILE,"profile.h") || die "Unable to open profile.h\n"; +@profile = <PROFILE>; +close PROFILE; + +open(METRICS,"> metrics.h") || die "Unable to open metrics.h for output\n"; + +print METRICS "#define COUNT_TIME_INDOM 0\n"; +print METRICS "#define BYTE_INDOM 1\n\n"; +print METRICS "#define FIELD_OFF(x) (unsigned)\&(((struct profile_stats *)NULL)->x)\n\n"; +print METRICS "typedef struct {\n"; +print METRICS "\tchar *name;\n"; +print METRICS "\tunsigned offset;\n"; +print METRICS "} samba_instance;\n\n"; + +@instnames = grep(/unsigned .*_time;/,@profile); +foreach $instnames (@instnames) { + chomp $instnames; + $instnames =~ s/^.*unsigned (.*)_time.*$/$1/; +} + +print METRICS "static samba_instance samba_counts[] = {"; +$first = 1; +foreach $1 (@instnames) { + if ($first == 1) { + $first = 0; + print METRICS "\n"; + } else { + print METRICS ",\n"; + } + print METRICS "\t{\"$1\", FIELD_OFF($1_count)}"; +} +print METRICS "\n};\n\n"; +print METRICS "static samba_instance samba_times[] = {"; +$first = 1; +foreach $1 (@instnames) { + if ($first == 1) { + $first = 0; + print METRICS "\n"; + } else { + print METRICS ",\n"; + } + print METRICS "\t{\"$1\", FIELD_OFF($1_time)}"; +} +print METRICS "\n};\n\n"; +print METRICS "static samba_instance samba_bytes[] = {"; +@instnames = grep(/unsigned .*_bytes;/,@profile); +$first = 1; +foreach $_ (@instnames) { + if ($first == 1) { + $first = 0; + print METRICS "\n"; + } else { + print METRICS ",\n"; + } + /^.*unsigned (.*)_bytes.*$/; + print METRICS "\t{\"$1\", FIELD_OFF($1_bytes)}"; +} +print METRICS "\n};\n"; + +close METRICS |