use v5.10; ## say
#my $log_file = @ARGV[0];
+#
+# TODO:
+# 1. append cpve version to the file name of full log
+# 2. output critical error of CPVE/PME such as "camera" camera error
+# 3. split the full log as sub logs against the call time
+# 4. plot the RTP stats
my $k_start_call = 'originateCall|answercall';
#my $k_start_call = 'originateCall';
# create jabber_full.log to add jabber.log, jabber.log.1, jabber.log.2
+my $out_dir = `pwd` . '/out/';
my @logs = glob "jabber.log*";
-my $full_logs = "jabber_full.log";
+my $full_logs = "$out_dir/jabber_full.log";
+
+#my $cpve_version;
#foreach (@logs) { say; }
#say @logs;
##}
## merge log files
-!system "cat $_ >> $full_logs" or die "$!" for (reverse @logs);
+!system "cat $_ >> $full_logs" or die "$!" for reverse @logs;
+
+my $version=
+print "===== write done ====\n";
## split file with each call
-open LOG, "<<$full_logs" or die "$!";
+my $call = "call0.log";
-open LOG, "<<$full_logs" or die "$!";
+open CALL, ">> $call" or die "$!";
+open LOG, "<", $full_logs or die "$!";
+my $index = 0;
while(<LOG>){
-
+## print CALL $_;
+## last if /originateCall/;
+ if ($_ =~ /originateCall/ ){
+ close
+ $index = $index+1;
+ open LOG, ">>" "call$index" or die "$!";
+ print LOG $_;
+ }
}
-
-
my $ip = (split / /, `ifconfig | grep "inet .*broadcast"`)[1];
-my $cpve_dir = '/Users/peli3/CPVE/cpve_trunk/';
-my $ecc_dir = '/Users/peli3/JCC/ecc-p2p/';
+my $cpve_dir = '/Users/peli3-imac/CPVE/cpve_trunk/';
+my $ecc_dir = '/Users/peli3-imac/JCC/ecc-p2p-mac/';
my $ecc_mac_libs = "$ecc_dir/contrib/cpve/lib/darwin/x86_64";
my $cpve_mac_libs = "$cpve_dir/target/dist/lib/darwin/x86_64";
#### building ecc
chdir $ecc_dir or die ": $!";
+!system "rm $ecc_dir/contrib/cpve/SConstruct" or die "$!" if -e "$ecc_dir/contrib/cpve/SConstruct";
!system "python runSconsBuild.py JabberMac64Bit -j 16 -t no --early_cpve --nofetch" or die " building ECC failed : $!";
print "copy bin-s bin-c\n";
print "####### DONE #######\n";
-
-#sub get_local_ip{
-# my @cc = (split / /, `ifconfig | grep "inet .*broadcast"`)[1];
-## @cc[1]; ## return value
-## return @cc[1];
-#}
-
-#print CONF "P2P_SERVER_IP=" . &get_local_ip . "\n";