[Pyukiwiki-cvs 0006217] CVS update: PyukiWiki-Devel-UTF8/plugin

Back to archive index

PyukiWiki CVS Commit pyuki****@lists*****
2012年 2月 19日 (日) 05:11:42 JST


Index: PyukiWiki-Devel-UTF8/plugin/server.inc.pl
diff -u PyukiWiki-Devel-UTF8/plugin/server.inc.pl:1.281 PyukiWiki-Devel-UTF8/plugin/server.inc.pl:1.282
--- PyukiWiki-Devel-UTF8/plugin/server.inc.pl:1.281	Sun Feb 19 02:24:02 2012
+++ PyukiWiki-Devel-UTF8/plugin/server.inc.pl	Sun Feb 19 05:11:42 2012
@@ -1,6 +1,6 @@
 ######################################################################
 # server.inc.pl - This is PyukiWiki, yet another Wiki clone.
-# $Id: server.inc.pl,v 1.281 2012/02/18 17:24:02 papu Exp $
+# $Id: server.inc.pl,v 1.282 2012/02/18 20:11:42 papu Exp $
 #
 # "PyukiWiki" version 0.2.0-p2-preview3 $$
 # Author: Nanami http://nanakochi.daiba.cx/
@@ -21,6 +21,12 @@
 # Perl詳細情報は、可能な限りのperlモジュールを検索するので、場合に
 # よっては、タイムアウトでInternal Server Errorになる可能性があります。
 ######################################################################
+# 0.2.0-p2 :
+# ベンチマークの所要時間を1/4にした
+# ベンチマークを分割実行できるようにした
+######################################################################
+
+use Time::HiRes qw(gettimeofday tv_interval);
 
 my @info_envs=(
 	":server",
@@ -82,6 +88,22 @@
 	"REGCOUNT:1"
 );
 
+my @bench1_envs=(
+	"MATHCOUNT:1",
+);
+
+my @bench2_envs=(
+	"PROCCOUNT:1",
+);
+
+my @bench3_envs=(
+	"FILECOUNT:1",
+);
+
+my @bench4_envs=(
+	"REGCOUNT:1"
+);
+
 my @perl_envs=(
 	":perl",
 	"PERLPATH:1",
@@ -153,55 +175,78 @@
 }
 
 sub plugin_server_bench {
-	$BENCH=(times)[0];
-	$mathcount=0;
-	while((times)[0]<$BENCH+1) {
-		$p=5557;
-		$q=5563;
-		$e=395131;
-		for($i=2;$i<$p;$i++) { $pp=$p%$i; }
-		for($i=2;$i<$q;$i++) { $qq=$q%$i; }
-		$n=$p*$q; $nn=($p-1)*($q-1);
-		&plugin_server_bench_gcd($nn,$e);
-		$a=&plugin_server_bench_euler($nn);
-		&plugin_server_bench_powermod($e,$a-1,$nn);
-		$mathcount++;
-	}
-	$BENCH=(times)[0];
-	$regcount=0;
-		open(R,"$::skin_file");
-	foreach(<R>) { $DATA.=$r; } close(R);
-	while((times)[0]<$BENCH+1) {
-		$test=$DATA;
-		for($i=0;$i<1000;$i++) {
-			$test=~s/\#/\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#/g;
-		}
-		$test=~s/\#.*//g;
-		$regcount++;
-	}
-	$BENCH=(times)[0];
-	$filecount=0;
-	while((times)[0]<$BENCH+1) {
+	my($mode)=@_;
+	if($mode eq 0 || $mode eq 1) {
+	#	$BENCH=(times)[0];
+		$BENCH1=[gettimeofday];
+		$BENCH2=[gettimeofday];
+		$mathcount=0;
+	#	while((times)[0]<$BENCH+1) {
+		while(sprintf("%.8f",tv_interval $BENCH1, $BENCH2)+0<=0.25) {
+			$p=5557;
+			$q=5563;
+			$e=395131;
+			for($i=2;$i<$p;$i++) { $pp=$p%$i; }
+			for($i=2;$i<$q;$i++) { $qq=$q%$i; }
+			$n=$p*$q; $nn=($p-1)*($q-1);
+			&plugin_server_bench_gcd($nn,$e);
+			$a=&plugin_server_bench_euler($nn);
+			&plugin_server_bench_powermod($e,$a-1,$nn);
+			$mathcount++;
+			$BENCH2=[gettimeofday];
+		}
+	}
+	if($mode eq 0 || $mode eq 4) {
+	#	$BENCH=(times)[0];
+		$regcount=0;
 		open(R,"$::skin_file");
-		foreach(<R>) { $DATA=$r; } close(R);
-		$filecount++;
-	}
-
-	$BENCH=(times)[0];
-	$proccount=0;
-	while((times)[0]<$BENCH+1) {
-		open(PROC,"$0");
-		foreach(<PROC>) {
-			$r=$_;
+		foreach(<R>) { $DATA.=$r; } close(R);
+		$BENCH1=[gettimeofday];
+		$BENCH2=[gettimeofday];
+	#	while((times)[0]<$BENCH+1) {
+		while(sprintf("%.8f",tv_interval $BENCH1, $BENCH2)+0<=0.25) {
+			$test=$DATA;
+			for($i=0;$i<1000;$i++) {
+				$test=~s/\#/\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#/g;
+			}
+			$test=~s/\#.*//g;
+			$regcount++;
+			$BENCH2=[gettimeofday];
+		}
+	}
+	if($mode eq 0 || $mode eq 3) {
+	#	$BENCH=(times)[0];
+		$BENCH1=[gettimeofday];
+		$BENCH2=[gettimeofday];
+		$filecount=0;
+	#	while((times)[0]<$BENCH+1) {
+		while(sprintf("%.8f",tv_interval $BENCH1, $BENCH2)+0<=0.25) {
+			open(R,"$::skin_file");
+			foreach(<R>) { $DATA=$r; } close(R);
+			$filecount++;
+			$BENCH2=[gettimeofday];
+		}
+	}
+	if($mode eq 0 || $mode eq 2) {
+	#	$BENCH=(times)[0];
+		$BENCH1=[gettimeofday];
+		$BENCH2=[gettimeofday];
+		$proccount=0;
+	#	while((times)[0]<$BENCH+1) {
+		while(sprintf("%.8f",tv_interval $BENCH1, $BENCH2)+0<=0.25) {
+			open(PROC,"$0");
+			foreach(<PROC>) {
+				$r=$_;
+			}
+			close(PROC);
+			$proccount++;
+			$BENCH2=[gettimeofday];
 		}
-		close(PROC);
-		$proccount++;
 	}
-
-	$ENV{MATHCOUNT}=$mathcount;
-	$ENV{PROCCOUNT}=$proccount;
-	$ENV{FILECOUNT}=$filecount;
-	$ENV{REGCOUNT}=$regcount;
+	$ENV{MATHCOUNT}=$mathcount*4;
+	$ENV{PROCCOUNT}=$proccount*4;
+	$ENV{FILECOUNT}=$filecount*4;
+	$ENV{REGCOUNT}=$regcount*4;
 }
 
 sub uptime {
@@ -583,6 +628,10 @@
 <input type="submit" name="perlinfo" value="$::resource{server_plugin_perlinfo_button}" />
 </td><td>
 <input type="submit" name="benchmark" value="$::resource{server_plugin_benchmark_button}" />
+<input type="submit" name="benchmark1" value="$::resource{server_plugin_benchmark1_button}" />
+<input type="submit" name="benchmark2" value="$::resource{server_plugin_benchmark2_button}" />
+<input type="submit" name="benchmark3" value="$::resource{server_plugin_benchmark3_button}" />
+<input type="submit" name="benchmark4" value="$::resource{server_plugin_benchmark4_button}" />
 @{[&linuxbutton]}
 @{[&freebsdbutton]}
 </td></tr></table></form>
@@ -627,8 +676,24 @@
 		@envs=@perl_envs;
 	} elsif($::form{benchmark} ne '') {
 		$mode="benchmark";
-		&plugin_server_bench;
+		&plugin_server_bench(0);
 		@envs=@bench_envs;
+	} elsif($::form{benchmark1} ne '') {
+		$mode="benchmark";
+		&plugin_server_bench(1);
+		@envs=@bench1_envs;
+	} elsif($::form{benchmark2} ne '') {
+		$mode="benchmark";
+		&plugin_server_bench(2);
+		@envs=@bench2_envs;
+	} elsif($::form{benchmark3} ne '') {
+		$mode="benchmark";
+		&plugin_server_bench(3);
+		@envs=@bench3_envs;
+	} elsif($::form{benchmark4} ne '') {
+		$mode="benchmark";
+		&plugin_server_bench(4);
+		@envs=@bench4_envs;
 	} elsif($::form{linux} ne '') {
 		$mode="linux";
 		@envs=@linux_info;



Pyukiwiki-cvs メーリングリストの案内
Back to archive index