3 ##############################################
4 # package to dump the mapi call hierarchy and
5 # add IDL regression support
7 # Copyright Julien Kerihuel 2007.
8 # <j.kerihuel@openchange.org>
10 # released under GNU GPL v3 or later
14 use FindBin qw($RealBin $Script);
16 use lib "$RealBin/lib";
22 my ($opt_outputdir) = '.';
24 my ($opt_highlight) = 0;
26 my ($opt_search_call) = 0;
27 my ($opt_dump_call) = 0;
31 my ($opt_verbose) = 0;
32 ############################################
36 print "mapi call hierarchy tracing tool and IDL regression support
37 Copyright (C) Julien Kerihuel <j.kerihuel\@openchange.org>
39 Usage: $Script [options]
43 --outputdir=OUTDIR put output in OUTDIR/ []
44 --graph create a png graph
45 --trace dump the mapi call hierarchy on command line
46 --verbose verbose output
49 --search-call=CALL trace a single call through a scenario
50 --dump-call dump all the packets containing the call specified
51 --highlight=CALL highlight a call in the generated graph
52 --inout=INOUT filter either requests (in) or response (out)
55 --error_report=in,out Investigate invalid packets
56 --stats Display statistics for a given scenario
63 my $result = GetOptions (
64 'help|h|?' => \$opt_help,
65 'outputdir=s' => \$opt_outputdir,
66 'graph|g' => \$opt_graph,
67 'highlight=s'=> \$opt_highlight,
68 'trace|t' => \$opt_trace,
69 'search-call=s' => \$opt_search_call,
70 'dump-call|d' => \$opt_dump_call,
71 'inout=s' => \$opt_inout,
72 'error_report=s' => \$opt_error,
73 'stats|s' => \$opt_stats,
74 'verbose|v' => \$opt_verbose
86 sub process_tracing($)
88 my $directory = shift;
89 my $outputdir = $opt_outputdir;
92 opendir(DIR,$directory) or die "Unable to process $directory";
95 my $EcDoRpc = MAPI::EcDoRpc->new($directory, $outputdir, $opt_verbose);
98 $EcDoRpc->analyze($opt_trace);
101 my @inout = split(/,/, $opt_error);
103 foreach (sort @inout) {
104 $EcDoRpc->error_report($_);
108 $EcDoRpc->stats() if ($opt_stats);
109 $EcDoRpc->search_call($opt_search_call, $opt_dump_call, $opt_inout) if ($opt_search_call);
110 $EcDoRpc->graph($outputdir, $opt_highlight) if ($opt_graph);
113 if (scalar(@ARGV) == 0) {
114 print "$Script: no input directory\n";
118 process_tracing($_) foreach (@ARGV);