⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bench-init.pl

📁 开启mysql的远程连接的方法 mysql-noinstall-5.1.6-alpha-win32.zip
💻 PL
📖 第 1 页 / 共 2 页
字号:
  $dbh->do($query) or    die "\nError executing '$query':\n$DBI::errstr\n";}## Run a query X times#sub time_fetch_all_rows{  my($test_text,$result_text,$query,$dbh,$test_count)=@_;  my($i,$loop_time,$end_time,$count,$rows,$estimated);  print $test_text . "\n"   if (defined($test_text));  $count=$rows=0;  $loop_time=new Benchmark;  for ($i=1 ; $i <= $test_count ; $i++)  {    $count++;    $rows+=fetch_all_rows($dbh,$query) or die $DBI::errstr;    $end_time=new Benchmark;    last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i,					   $test_count));  }  $end_time=new Benchmark;  if ($estimated)  { print "Estimated time"; }  else  { print "Time"; }  print " for $result_text ($count:$rows) " .    timestr(timediff($end_time, $loop_time),"all") . "\n\n";}## Handle estimated time of the server is too slow# Returns 0 if one should continue as normal#sub predict_query_time{  my ($loop_time,$end_time,$count_ref,$loop,$loop_count)= @_;  my ($k,$tmp);  if (($end_time->[0] - $loop_time->[0]) > $opt_time_limit)  {    # We can't wait until the SUN dies.  Try to predict the end time    if ($loop != $loop_count)    {      $tmp=($end_time->[0] - $loop_time->[0]);      print "Note: Query took longer then time-limit: $opt_time_limit\nEstimating end time based on:\n";      print "$$count_ref queries in $loop loops of $loop_count loops took $tmp seconds\n";      for ($k=0; $k < 3; $k++)      {	$tmp=$loop_time->[$k]+($end_time->[$k]-$loop_time->[$k])/$loop*	  $loop_count;	$estimated[$k]+=($tmp-$end_time->[$k]);	$end_time->[$k]=$tmp;      }      $$count_ref= int($$count_ref/$loop*$loop_count);      return 1;    }  }  return 0;}## standard end of benchmark#sub end_benchmark{  my ($start_time)=@_;  $end_time=new Benchmark;  if ($estimated[0])  {    print "Estimated total time: ";    $end_time->[0]+=$estimated[0];    $end_time->[1]+=$estimated[1];    $end_time->[2]+=$estimated[2];  }  else  {    print "Total time: "    }  print timestr(timediff($end_time, $start_time),"all") . "\n";  exit 0;}sub print_time{  my ($estimated)=@_;  if ($estimated)  { print "Estimated time"; }  else  { print "Time"; }}## Create a filename part for the machine that can be used for log file.#sub machine_part{  my ($name,$orig);  return $opt_machine if (length($opt_machine)); # Specified by user# Specified by user  $orig=$name=machine();  $name="win9$1" if ($orig =~ /win.*9(\d)/i);  $name="NT_$1" if ($orig =~ /Windows NT.*(\d+\.\d+)/i);  $name="win2k" if ($orig =~ /Windows 2000/i);  $name =~ s/\s+/_/g;		# Make the filenames easier to parse  $name =~ s/-/_/g;  $name =~ s/\//_/g;  return $name;}sub machine{  my @name = POSIX::uname();  my $name= $name[0] . " " . $name[2] . " " . $name[4];  return $name;}## Usage#sub usage{    print <<EOF;The MySQL benchmarks Ver $benchmark_versionAll benchmarks takes the following options:--comments  Add a comment to the benchmark output.  Comments should contain  extra information that 'uname -a' doesn\'t give and if the database was  stared with some specific, non default, options.--cmp=server[,server...]  Run the test with limits from the given servers.  If you run all servers  with the same --cmp, you will get a test that is comparable between  the different sql servers.--create-options=#  Extra argument to all create statements.  If you for example want to  create all MySQL tables as BDB tables use:  --create-options=ENGINE=BDB--database (Default $opt_database)  In which database the test tables are created.--debug  This is a test specific option that is only used when debugging a test.  Print out debugging information.--dir (Default $opt_dir)  Option to 'run-all-tests' to where the test results should be stored.--fast  Allow the database to use non standard ANSI SQL commands to make the  test go faster.--fast-insert  Use "insert into table_name values(...)" instead of  "insert into table_name (....) values(...)"  If the database supports it, some tests uses multiple value lists.--field-count  This is a test specific option that is only used when debugging a test.  This usually means how many fields there should be in the test table.--force  This is a test specific option that is only used when debugging a test.  Continue the test even if there is some error.  Delete tables before creating new ones.--groups (Default $opt_groups)  This is a test specific option that is only used when debugging a test.  This usually means how many different groups there should be in the test.--lock-tables  Allow the database to use table locking to get more speed.--log  Option to 'run-all-tests' to save the result to the '--dir' directory.--loop-count (Default $opt_loop_count)  This is a test specific option that is only used when debugging a test.  This usually means how many times times each test loop is executed.--help  Shows this help--host='host name' (Default $opt_host)  Host name where the database server is located.--machine="machine or os_name"  The machine/os name that is added to the benchmark output filename.  The default is the OS name + version.--odbc  Use the ODBC DBI driver to connect to the database.--password='password'  Password for the current user.--socket='socket'  If the database supports connecting through a Unix socket,  then use this socket to connect--regions  This is a test specific option that is only used when debugging a test.  This usually means how AND levels should be tested.--old-headers  Get the old benchmark headers from the old RUN- file.--server='server name'  (Default $opt_server)  Run the test on the given SQL server.  Known servers names are: Access, Adabas, AdabasD, Empress, Oracle,  Informix, DB2, mSQL, MS-SQL, MySQL, Pg, Solid and Sybase--silent  Don't print info about the server when starting test.--skip-delete  This is a test specific option that is only used when debugging a test.  This will keep the test tables after the test is run.--skip-test=test1[,test2,...]  For run-all-programs;  Don\'t execute the named tests.--small-test  This runs some tests with smaller limits to get a faster test.  Can be used if you just want to verify that the database works, but  don't have time to run a full test.--small-tables  This runs some tests that generate big tables with fewer rows.  This can be used with databases that can\'t handle that many rows  because of pre-sized partitions.--suffix (Default $opt_suffix)  The suffix that is added to the database name in the benchmark output  filename.  This can be used to run the benchmark multiple times with  different server options without overwritten old files.  When using --fast the suffix is automaticly set to '_fast'.--random  Inform test suite that we are generate random inital values for sequence of  test executions. It should be used for imitation of real conditions.--threads=# (Default 5)  Number of threads for multi-user benchmarks.--tcpip  Inform test suite that we are using TCP/IP to connect to the server. In  this case we can\t do many new connections in a row as we in this case may  fill the TCP/IP stack--time-limit (Default $opt_time_limit)  How long a test loop is allowed to take, in seconds, before the end result  is 'estimated'.--use-old-results  Option to 'run-all-tests' to use the old results from the  '--dir' directory  instead of running the tests.--user='user_name'  User name to log into the SQL server.--verbose  This is a test specific option that is only used when debugging a test.  Print more information about what is going on.--optimization='some comments' Add coments about optimization of DBMS, which was done before the test. --hw='some comments' Add coments about hardware used for this test.--connect-options='some connect options'  Add options, which uses at DBI connect.  For example --connect-options=mysql_read_default_file=/etc/my.cnf.EOF  exit(0);}######## The end of the base file ...####1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -