#!/usr/local/bin/perl # -*-Fundamental-*- # # Copyright (c) 1996 Network Appliance, Inc. # # You may distribute under the terms of the Artistic License, as # specified in the README file included in the ttt distribution. # # $Id: //depot/tools/main/p4bench/p4bench#2 $ unlink "/u/rmg/ttt_log"; $dir = "/u/rmg/pmcheck"; sub opts { &ttt_add_opt("cli_env", "^", "/bin/env", "user to run as"); &ttt_add_opt("user", "^", "$user", "user to run as"); &ttt_add_opt("srvX_host", "[a-z-]+", "localhost", "host to run p4 server X on"); &ttt_add_opt("srvY_host", "[a-z-]+", "localhost", "host to run p4 server Y on"); &ttt_add_opt("srvZ_host", "[a-z-]+", "localhost", "host to run p4 server Z on"); &ttt_add_opt("srvX_port", "\d+", "1680", "port to run p4 server X on"); &ttt_add_opt("srvY_port", "\d+", "1682", "port to run p4 server Y on"); &ttt_add_opt("srvZ_port", "\d+", "1684", "port to run p4 server Z on"); &ttt_add_opt("cli_host", "[a-z-]+", "localhost", "host to run p4 clients on"); &ttt_add_opt("srvX_root", ".*", "$dir/srvX_root", "pathname for srv X $4ROOT"); &ttt_add_opt("srvY_root", ".*", "$dir/srvY_root", "pathname for srv Y $P4ROOT"); &ttt_add_opt("srvZ_root", ".*", "$dir/srvZ_root", "pathname for srv Z $P4ROOT"); &ttt_add_opt("srvX_cli", ".*", "$dir/srvX_cli", "pathname for srv X $P4ROOT"); &ttt_add_opt("srvY_cli", ".*", "$dir/srvY_cli", "pathname for srv Y $P4ROOT"); &ttt_add_opt("srvZ_cli", ".*", "$dir/srvZ_cli", "pathname for srv Z $P4ROOT"); &ttt_add_opt("p4d", ".*", "/u/p4/dist/r00.2/bin.osf/p4d", "p4d to run"); &ttt_add_opt("p4", ".*", "/u/p4/dist/r00.2/bin.osf/p4", "p4 to run"); } sub prereqchk { 1; } ##### Begin ttt standard preamble - do not change this code! ##### $UNIX = 1; sub dirname { local($dir) = @_; $dir =~ s%^$%.%; $dir = "$dir/"; if ($dir =~ m"^/[^/]*//*$") { return "/"; } if ($dir =~ m"^.*[^/]//*[^/][^/]*//*$") { $dir =~ s"^(.*[^/])//*[^/][^/]*//*$"$1"; { return $dir; } } #" [for cpp] return "."; } $ttt_here = `/bin/pwd`; chop $ttt_here; chdir &dirname($0); $tttroot = `/bin/pwd`; chop $tttroot; chdir $ttt_here; require "$tttroot/tttLib.pl"; ##### End ttt standard preamble - do not change the above code! ##### &ttt_rexec($srvX_host, "rm -rf $srvX_root && mkdir -p $srvX_root"); &ttt_rexec($srvX_host, "rm -rf $srvX_cli && mkdir $srvX_cli"); &ttt_rexec($srvY_host, "rm -rf $srvY_root && mkdir -p $srvY_root"); &ttt_rexec($srvY_host, "rm -rf $srvY_cli && mkdir $srvY_cli"); &ttt_rexec($srvZ_host, "rm -rf $srvZ_root && mkdir -p $srvZ_root"); &ttt_rexec($srvZ_host, "rm -rf $srvZ_cli && mkdir $srvZ_cli"); #===== initialize Perforce servers $p4dX_id = &ttt_start_agent($srvX_host, "$p4d -r $srvX_root -p $srvX_port -J journal -L log", 1, $user); $rbits_p4dX = $agents{$p4dX_id, "STDOUTt"} | $agents{$p4dX_id, "STDERRt"}; $p4dY_id = &ttt_start_agent($srvY_host, "$p4d -r $srvY_root -p $srvY_port -J journal -L log", 1, $user); $rbits_p4dY = $agents{$p4dY_id, "STDOUTt"} | $agents{$p4dY_id, "STDERRt"}; &ttt_int_agent($p4dX_id, $rbits_p4dX, "", "Perforce Server starting..."); &ttt_int_agent($p4dY_id, $rbits_p4dY, "", "Perforce Server starting..."); # Seems to be necessary so the first client op doesn't try to barge # in before the server is really fully initialized! # sleep 8; &ttt_rexec($cli_host, "$p4 -p $srvX_host:$srvX_port info"); &ttt_rexec($cli_host, "$p4 -p $srvY_host:$srvY_port info"); # Make client workspaces # $p4X_c = "$p4 -p $srvX_host:$srvX_port -c cli"; &ttt_rexec($cli_host, "cd $srvX_cli && $p4X_c client -o | $p4X_c client -i"); $p4Y_c = "$p4 -p $srvY_host:$srvY_port -c cli"; &ttt_rexec($cli_host, "cd $srvY_cli && $p4Y_c client -o | $p4Y_c client -i"); # Verify that the clients now exist &ttt_rexec($cli_host, "$p4 -p $srvX_host:$srvX_port clients"); &ttt_rexec($cli_host, "$p4 -p $srvY_host:$srvY_port clients"); # OK, set up the test scenario # # We want: # # merged # time change rev change # 0 x1 x#1 1 # 1 x2 x#2 2 # 2 y1 y#1 5 # 3 x3 x#3 3 # 4 y2 y#2 6 # 5 x4 x#4 4 # 6 y3 y#3 7 # # merged # time change rev change # 0 x1 x#1 1 # 1 x2 x#2 2 # 3 x3 x#3 3 # 5 x4 x#4 4 # 2 y1 y#1 5 # 4 y2 y#2 6 # 6 y3 y#3 7 &ttt_rexec($cli_host, "cd $srvX_cli". " && date > X". " && $p4X_c add X". " && $cli_env P4EDITOR='$tttroot/p4submit changes' $p4X_c submit"); sleep 5; $before_2 = time; &ttt_rexec($cli_host, "cd $srvX_cli". " && $p4X_c edit X". " && date >> X". " && $cli_env P4EDITOR='$tttroot/p4submit changes' $p4X_c submit"); sleep 5; &ttt_rexec($cli_host, "cd $srvY_cli". " && date > Y". " && $p4Y_c add Y". " && $cli_env P4EDITOR='$tttroot/p4submit changes' $p4Y_c submit"); sleep 5; $after_3 = time; &ttt_rexec($cli_host, "cd $srvX_cli". " && $p4X_c edit X". " && date >> X". " && $cli_env P4EDITOR='$tttroot/p4submit changes' $p4X_c submit"); sleep 5; &ttt_rexec($cli_host, "cd $srvY_cli". " && $p4Y_c edit Y". " && date >> Y". " && $cli_env P4EDITOR='$tttroot/p4submit changes' $p4Y_c submit"); sleep 5; &ttt_rexec($cli_host, "cd $srvX_cli". " && $p4X_c edit X". " && date >> X". " && $cli_env P4EDITOR='$tttroot/p4submit changes' $p4X_c submit"); sleep 5; &ttt_rexec($cli_host, "cd $srvY_cli". " && $p4Y_c edit Y". " && date >> Y". " && $cli_env P4EDITOR='$tttroot/p4submit changes' $p4Y_c submit"); &ttt_rexec($cli_host, "$p4X_c changes"); &ttt_rexec($cli_host, "$p4Y_c changes"); # whew. #===== shutdown # &ttt_rexec($cli_host, "$p4X_c admin checkpoint"); &ttt_rexec($cli_host, "$p4X_c admin stop"); &ttt_rexec($cli_host, "$p4Y_c admin checkpoint"); &ttt_rexec($cli_host, "$p4Y_c admin stop"); &ttt_read_agents($rbits_p4dX, $timeo); $status = &ttt_close_agent($p4dX_id); &ttt_msg($p4dX_id, "exit status = $status\n"); &ttt_read_agents($rbits_p4dY, $timeo); $status = &ttt_close_agent($p4dY_id); &ttt_msg($p4dY_id, "exit status = $status\n"); #===== merge &ttt_rexec($cli_host, "$tttroot/perfmerge2 --output $srvZ_root/checkpoint.merged ". "--append $srvX_root/checkpoint.1 $srvY_root/checkpoint.1"); $p4dZ_id = &ttt_start_agent($srvZ_host, "$p4d -r $srvZ_root -p $srvZ_port -jr $srvZ_root/checkpoint.merged", 1, $user); $p4dZ_id = &ttt_start_agent($srvZ_host, "$p4d -r $srvZ_root -p $srvZ_port -J journal -L log", 1, $user); $rbits_p4dZ = $agents{$p4dZ_id, "STDOUTt"} | $agents{$p4dZ_id, "STDERRt"}; &ttt_int_agent($p4dZ_id, $rbits_p4dZ, "", "Perforce Server starting..."); sleep 10; #===== and do the test we're really interested in: # $p4Z_c = "$p4 -p $srvZ_host:$srvZ_port -c cli"; &ttt_rexec($cli_host, "$p4Z_c changes //...\@2,5"); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($before_2); $before_2 = sprintf("%d/%d/%d:%d:%d:%d", $year+1900, $mon+1, $mday, $hour, $min, $sec); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($after_3); $after_3 = sprintf("%d/%d/%d:%d:%d:%d", $year+1900, $mon+1, $mday, $hour, $min, $sec); &ttt_rexec($cli_host, "$p4Z_c changes //...\@$before_2,$after_3"); #===== shutdown p4dZ # if (0) { &ttt_rexec($cli_host, "$p4Z_c admin checkpoint"); &ttt_rexec($cli_host, "$p4Z_c admin stop"); &ttt_read_agents($rbits_p4dZ, $timeo); $status = &ttt_close_agent($p4dZ_id); &ttt_msg($p4dZ_id, "exit status = $status\n"); #&ttt_rexec("localhost", "rm -rf $dir"); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 800 | Richard Geiger |
pmcheck really isn't part of the benchmarking stuff at all. (In fact, we should probably split out ttt, too. Always so much to do!) |
||
#1 | 799 | Richard Geiger |
The first version of "p4bench", scripts used to implement a crude Perforce benchmarking system, as mentioned in http://maillist.perforce.com/pipermail/perforce-user/2001-February/005288.html Beware, it's not pretty and there's no documentation, but it's a starting point for bigger and better things. |