diff --git a/test/Performance/README.md b/test/Performance/README.md index d58b49e7..7be4ca55 100644 --- a/test/Performance/README.md +++ b/test/Performance/README.md @@ -23,19 +23,17 @@ Run `Windows PowerShell` as administrator. PHPBench is used to run the benchmarks. Visit http://phpbench.readthedocs.io/en/latest/introduction.html to have an idea how the tool works. ##### 1. Modify lib/connect.php with the test database credentials -##### 2. Execute run-perf_tests.py +##### 2. Modify lib/result_db.php with the result database credentials +##### 3. The number of iterations for each test can be modified in the test itself (e.g., in test/Performance/benchmark/sqlsrv/SqlsrvSelectVersionBench.php). Each bench class in a test, or the parent class that it extends from, has a @Iteration(n) annotation. If you change the number in this annotation, you will change the number of iterations run for this test. By default, most tests are set to 1000 iterations. +##### 4. Execute run-perf_tests.py. ### Windows - py.exe run-perf_tests.py -platform -iterations -iterations-large -result-server -result-db -result-uid -result-pwd ### Linux and Mac On Linux and Mac, the script must be executed with `sudo python3` because to enable pooling it needs to modify odbcinst.ini system file. As an improvement, the location of the odbcinst.ini file can be changed so that, sudo is not requiered. - python3 run-perf_tests.py -platform -iterations -iterations-large -result-server -result-db -result-uid -result-pwd + python3 run-perf_tests.py -platform | tee run-perf_output.txt `-platform` - The platform that the tests are ran on. Must be one of the following: Windows10, WindowsServer2016, WindowsServer2012, Ubuntu16, RedHat7, Sierra. -`-iterations` - The number of iterations for regular tests. -`-iterations-large` - The number of iterations for the tests that fetch large data. Usually set to 1. -`-result-server` - The server containing the result database. It is assumed that the result database s already setup before running the tests. -`-result-db` - Database name. With the current result database setup files, this should be set to `TestResults`. -`-result-uid` - Result database username. -`-result-pwd` - Result database password. +`-php-driver` (optional) - The driver that the tests are ran on. Must be one of the following: sqlsrv, pdo_sqlsrv, or both. Default is both. +`-testname` (optional) - The test to run. Must be the file name (not including path) of one test or 'all'. Default is 'all'. If one test is specified, must also specify the -php-driver option to sqlsrv or pdo_sqlsrv. \ No newline at end of file diff --git a/test/Performance/benchmark/pdo_sqlsrv/regular/PDOConnectionBench.php b/test/Performance/benchmark/pdo_sqlsrv/PDOConnectionBench.php similarity index 55% rename from test/Performance/benchmark/pdo_sqlsrv/regular/PDOConnectionBench.php rename to test/Performance/benchmark/pdo_sqlsrv/PDOConnectionBench.php index f6244bac..9e995b34 100644 --- a/test/Performance/benchmark/pdo_sqlsrv/regular/PDOConnectionBench.php +++ b/test/Performance/benchmark/pdo_sqlsrv/PDOConnectionBench.php @@ -1,12 +1,15 @@ conn = PDOSqlsrvUtil::connect(); } /* * Each iteration creates a database, a table and a stored procedure in that database and drops the database at the end. * Note that, execDirect function are used to execute all the queries. */ - public function benchCreateDbTableProc(){ + public function benchCreateDbTableProc() + { $randomNum = rand(); $databaseName = "test_db_$randomNum"; $tableName = "test_table_$randomNum"; @@ -24,7 +28,8 @@ class PDOCreateDbTableProcBench{ PDOSqlsrvUtil::dropDatabase( $this->conn, $databaseName ); } - public function disconnect(){ + public function disconnect() + { PDOSqlsrvUtil::disconnect( $this->conn ); } } diff --git a/test/Performance/benchmark/pdo_sqlsrv/regular/PDODeleteBench.php b/test/Performance/benchmark/pdo_sqlsrv/PDODeleteBench.php similarity index 65% rename from test/Performance/benchmark/pdo_sqlsrv/regular/PDODeleteBench.php rename to test/Performance/benchmark/pdo_sqlsrv/PDODeleteBench.php index b3eb788e..e14b26ff 100644 --- a/test/Performance/benchmark/pdo_sqlsrv/regular/PDODeleteBench.php +++ b/test/Performance/benchmark/pdo_sqlsrv/PDODeleteBench.php @@ -1,34 +1,42 @@ tableName = "datatypes_".rand(); } - public function connect(){ + public function connect() + { $this->conn = PDOSqlsrvUtil::connect(); } - public function createTable(){ + public function createTable() + { PDOSqlsrvUtil::createCRUDTable( $this->conn, $this->tableName ); } - public function generateInsertValues(){ + public function generateInsertValues() + { $this->insertValues = PDOSqlsrvUtil::generateInsertValues(); } - public function insertWithPrepare(){ - for( $i=0; $i<1000; $i++ ){ + public function insertWithPrepare() + { + for( $i=0; $iconn, $this->tableName, $this->insertValues ); } } @@ -36,17 +44,21 @@ class PDODeleteBench{ * Each iteration inserts 1000 rows into the table, benchDelete deletes top row from the table 1000 times. * Note that, every delete calls prepare and execute APIs. */ - public function benchDelete(){ - for( $i=0; $i<1000; $i++ ){ + public function benchDelete() + { + for( $i=0; $iconn, $this->tableName ); } } - public function dropTable(){ + public function dropTable() + { PDOSqlsrvUtil::dropTable( $this->conn, $this->tableName ); } - public function disconnect(){ + public function disconnect() + { PDOSqlsrvUtil::disconnect( $this->conn ); } diff --git a/test/Performance/benchmark/pdo_sqlsrv/regular/PDOFetchBench.php b/test/Performance/benchmark/pdo_sqlsrv/PDOFetchBench.php similarity index 67% rename from test/Performance/benchmark/pdo_sqlsrv/regular/PDOFetchBench.php rename to test/Performance/benchmark/pdo_sqlsrv/PDOFetchBench.php index e7e17b4d..9601382a 100644 --- a/test/Performance/benchmark/pdo_sqlsrv/regular/PDOFetchBench.php +++ b/test/Performance/benchmark/pdo_sqlsrv/PDOFetchBench.php @@ -1,32 +1,39 @@ tableName = "datatypes_".rand(); } - public function connect(){ + public function connect() + { $this->conn = PDOSqlsrvUtil::connect(); } - public function createTable(){ + public function createTable() + { PDOSqlsrvUtil::createCRUDTable( $this->conn, $this->tableName ); } - public function generateInsertValues(){ + public function generateInsertValues() + { $this->insertValues = PDOSqlsrvUtil::generateInsertValues(); } - public function insertWithPrepare(){ + public function insertWithPrepare() + { PDOSqlsrvUtil::insertWithPrepare( $this->conn, $this->tableName, $this->insertValues ); } @@ -34,17 +41,21 @@ class PDOFetchBench{ * Each iteration inserts a row into the table, benchFetchWithPrepare() fetches that row 1000 times. * Note that, every fetch calls prepare, execute and fetch APIs. */ - public function benchFetchWithPrepare(){ - for( $i=0; $i<1000; $i++){ + public function benchFetchWithPrepare() + { + for( $i=0; $iconn, $this->tableName ); } } - public function dropTable(){ + public function dropTable() + { PDOSqlsrvUtil::dropTable( $this->conn, $this->tableName ); } - public function disconnect(){ + public function disconnect() + { PDOSqlsrvUtil::disconnect( $this->conn ); } } diff --git a/test/Performance/benchmark/pdo_sqlsrv/large/PDOFetchLargeBench.php b/test/Performance/benchmark/pdo_sqlsrv/PDOFetchLargeBench.php similarity index 73% rename from test/Performance/benchmark/pdo_sqlsrv/large/PDOFetchLargeBench.php rename to test/Performance/benchmark/pdo_sqlsrv/PDOFetchLargeBench.php index b3152745..26fab48c 100644 --- a/test/Performance/benchmark/pdo_sqlsrv/large/PDOFetchLargeBench.php +++ b/test/Performance/benchmark/pdo_sqlsrv/PDOFetchLargeBench.php @@ -2,30 +2,36 @@ use PDOSqlsrvPerfTest\PDOSqlsrvUtil; /** + * @Iterations(1) * @BeforeMethods({"connect", "setTableName" }) * @AfterMethods({ "disconnect"}) */ -class PDOFetchLargeBench{ +class PDOFetchLargeBench +{ private $conn; private $tableName; - public function setTableName(){ + public function setTableName() + { //Assumes the table is already populated with data $this->tableName = "LargeDB.dbo.datatypes"; } - public function connect(){ + public function connect() + { $this->conn = PDOSqlsrvUtil::connect(); } /* * Each iteration calls prepare, execute and fetch APIs to fetch the already populdated data */ - public function benchFetchWithPrepare(){ + public function benchFetchWithPrepare() + { PDOSqlsrvUtil::fetchWithPrepare( $this->conn, $this->tableName ); } - public function disconnect(){ + public function disconnect() + { PDOSqlsrvUtil::disconnect( $this->conn ); } } diff --git a/test/Performance/benchmark/pdo_sqlsrv/regular/PDOInsertBench.php b/test/Performance/benchmark/pdo_sqlsrv/PDOInsertBench.php similarity index 65% rename from test/Performance/benchmark/pdo_sqlsrv/regular/PDOInsertBench.php rename to test/Performance/benchmark/pdo_sqlsrv/PDOInsertBench.php index 73b0e191..99d47948 100644 --- a/test/Performance/benchmark/pdo_sqlsrv/regular/PDOInsertBench.php +++ b/test/Performance/benchmark/pdo_sqlsrv/PDOInsertBench.php @@ -1,45 +1,55 @@ tableName = "datatypes_".rand(); } - public function connect(){ + public function connect() + { $this->conn = PDOSqlsrvUtil::connect(); } - public function createTable(){ + public function createTable() + { PDOSqlsrvUtil::createCRUDTable( $this->conn, $this->tableName ); } - public function generateInsertValues(){ + public function generateInsertValues() + { $this->insertValues = PDOSqlsrvUtil::generateInsertValues(); } /** * Each iteration inserts 1000 rows into the table. * Note that, every insertion calls prepare, bindParam and execute APIs. */ - public function benchInsertWithPrepare(){ - for ( $i=0; $i<1000; $i++){ + public function benchInsertWithPrepare() + { + for ( $i=0; $iconn, $this->tableName, $this->insertValues ); } } - public function dropTable(){ + public function dropTable() + { PDOSqlsrvUtil::dropTable( $this->conn, $this->tableName ); } - public function disconnect(){ + public function disconnect() + { PDOSqlsrvUtil::disconnect( $this->conn ); } } diff --git a/test/Performance/benchmark/pdo_sqlsrv/regular/PDOSelectVersionBench.php b/test/Performance/benchmark/pdo_sqlsrv/PDOSelectVersionBench.php similarity index 69% rename from test/Performance/benchmark/pdo_sqlsrv/regular/PDOSelectVersionBench.php rename to test/Performance/benchmark/pdo_sqlsrv/PDOSelectVersionBench.php index 10bc5a77..23631e26 100644 --- a/test/Performance/benchmark/pdo_sqlsrv/regular/PDOSelectVersionBench.php +++ b/test/Performance/benchmark/pdo_sqlsrv/PDOSelectVersionBench.php @@ -2,24 +2,29 @@ use PDOSqlsrvPerfTest\PDOSqlsrvUtil; /** + * @Iterations(10000) * @BeforeMethods({"connect"}) * @AfterMethods({"disconnect"}) */ -class PDOSelectVersionBench{ +class PDOSelectVersionBench +{ private $conn; - public function connect(){ + public function connect() + { $this->conn = PDOSqlsrvUtil::connect(); } /* * Each iteration calls execDirect API to fetch @@Version */ - public function benchSelectVersion(){ + public function benchSelectVersion() + { $version = PDOSqlsrvUtil::selectVersion( $this->conn ); } - public function disconnect(){ + public function disconnect() + { PDOSqlsrvUtil::disconnect( $this->conn ); } } diff --git a/test/Performance/benchmark/pdo_sqlsrv/regular/PDOUpdateBench.php b/test/Performance/benchmark/pdo_sqlsrv/PDOUpdateBench.php similarity index 68% rename from test/Performance/benchmark/pdo_sqlsrv/regular/PDOUpdateBench.php rename to test/Performance/benchmark/pdo_sqlsrv/PDOUpdateBench.php index 2a582f0b..cceaac60 100644 --- a/test/Performance/benchmark/pdo_sqlsrv/regular/PDOUpdateBench.php +++ b/test/Performance/benchmark/pdo_sqlsrv/PDOUpdateBench.php @@ -1,11 +1,13 @@ tableName = "datatypes_".rand(); } - public function connect(){ + public function connect() + { $this->conn = PDOSqlsrvUtil::connect(); } - public function createTable(){ + public function createTable() + { PDOSqlsrvUtil::createCRUDTable( $this->conn, $this->tableName ); } - public function generateInsertValues(){ + public function generateInsertValues() + { $this->insertValues = PDOSqlsrvUtil::generateInsertValues(); } - public function insertWithPrepare(){ + public function insertWithPrepare() + { PDOSqlsrvUtil::insertWithPrepare( $this->conn, $this->tableName, $this->insertValues ); } - public function generateUpdateValues(){ + public function generateUpdateValues() + { $this->updateValues = PDOSqlsrvUtil::generateUpdateValues(); } - public function generateUpdateParams(){ + public function generateUpdateParams() + { $this->updateParams = PDOSqlsrvUtil::generateUpdateParams(); } /** * Each iteration inserts a row into the table, updateWithPrepare() updates that row 1000 times. * Note that, every update calls prepare, bindParam and execute APIs. */ - public function benchUpdateWithPrepare(){ - for( $i=0; $i<1000; $i++ ){ + public function benchUpdateWithPrepare() + { + for( $i=0; $iconn, $this->tableName, $this->updateValues, $this->updateParams ); } } - public function dropTable(){ + public function dropTable() + { PDOSqlsrvUtil::dropTable( $this->conn, $this->tableName ); } - public function disconnect(){ + public function disconnect() + { PDOSqlsrvUtil::disconnect( $this->conn ); } diff --git a/test/Performance/benchmark/sqlsrv/regular/SqlsrvConnectionBench.php b/test/Performance/benchmark/sqlsrv/SqlsrvConnectionBench.php similarity index 53% rename from test/Performance/benchmark/sqlsrv/regular/SqlsrvConnectionBench.php rename to test/Performance/benchmark/sqlsrv/SqlsrvConnectionBench.php index 1a59f6db..648a77db 100644 --- a/test/Performance/benchmark/sqlsrv/regular/SqlsrvConnectionBench.php +++ b/test/Performance/benchmark/sqlsrv/SqlsrvConnectionBench.php @@ -1,12 +1,15 @@ conn = SqlsrvUtil::connect(); } @@ -16,7 +19,8 @@ class SqlsrvCreateDbTableProcBench{ * Each iteration creates a database, a table and a stored procedure in that database and drops the database at the end. * Note that, ODBC SQLExecDirect function are used to execute all the queries. */ - public function benchCreateDbTableProc(){ + public function benchCreateDbTableProc() + { $randomNum = rand(); $databaseName = "test_db_$randomNum"; $tableName = "test_table_$randomNum"; @@ -25,7 +29,8 @@ class SqlsrvCreateDbTableProcBench{ SqlsrvUtil::dropDatabase( $this->conn, $databaseName ); } - public function disconnect(){ + public function disconnect() + { SqlsrvUtil::disconnect( $this->conn ); } } diff --git a/test/Performance/benchmark/sqlsrv/regular/SqlsrvDeleteBench.php b/test/Performance/benchmark/sqlsrv/SqlsrvDeleteBench.php similarity index 64% rename from test/Performance/benchmark/sqlsrv/regular/SqlsrvDeleteBench.php rename to test/Performance/benchmark/sqlsrv/SqlsrvDeleteBench.php index e47070a5..73103c01 100644 --- a/test/Performance/benchmark/sqlsrv/regular/SqlsrvDeleteBench.php +++ b/test/Performance/benchmark/sqlsrv/SqlsrvDeleteBench.php @@ -1,34 +1,42 @@ tableName = "datatypes_".rand(); } - public function connect(){ + public function connect() + { $this->conn = SqlsrvUtil::connect(); } - public function createTable(){ + public function createTable() + { SqlsrvUtil::createCRUDTable( $this->conn, $this->tableName ); } - public function generateInsertValues(){ + public function generateInsertValues() + { $this->insertValues = SqlsrvUtil::generateInsertValues(); } - public function insertWithPrepare(){ - for ( $i=0; $i<1000; $i++ ){ + public function insertWithPrepare() + { + for ( $i=0; $iconn, $this->tableName, $this->insertValues ); } } @@ -36,17 +44,21 @@ class SqlsrvDeleteBench{ * Each iteration inserts 1000 rows into the table, benchDelete deletes top row from the table 1000 times. * Note that, every delete calls prepare and execute APIs. */ - public function benchDelete(){ - for( $i=0; $i<1000; $i++ ){ + public function benchDelete() + { + for( $i=0; $iconn, $this->tableName ); } } - public function dropTable(){ + public function dropTable() + { SqlsrvUtil::dropTable( $this->conn, $this->tableName ); } - public function disconnect(){ + public function disconnect() + { SqlsrvUtil::disconnect( $this->conn ); } diff --git a/test/Performance/benchmark/sqlsrv/regular/SqlsrvFetchBench.php b/test/Performance/benchmark/sqlsrv/SqlsrvFetchBench.php similarity index 66% rename from test/Performance/benchmark/sqlsrv/regular/SqlsrvFetchBench.php rename to test/Performance/benchmark/sqlsrv/SqlsrvFetchBench.php index 035903c2..ec06709d 100644 --- a/test/Performance/benchmark/sqlsrv/regular/SqlsrvFetchBench.php +++ b/test/Performance/benchmark/sqlsrv/SqlsrvFetchBench.php @@ -1,35 +1,40 @@ tableName = "datatypes_".rand(); } - public function connect(){ + public function connect() + { $this->conn = SqlsrvUtil::connect(); } - public function createTable(){ + public function createTable() + { SqlsrvUtil::createCRUDTable( $this->conn, $this->tableName ); } - public function generateInsertValues(){ + public function generateInsertValues() + { $this->insertValues = SqlsrvUtil::generateInsertValues(); } - public function insertWithPrepare(){ + public function insertWithPrepare() + { SqlsrvUtil::insertWithPrepare( $this->conn, $this->tableName, $this->insertValues ); } @@ -37,17 +42,21 @@ class SqlsrvFetchBench{ * Each iteration inserts a row into the table, benchFetchWithPrepare() fetches that row 1000 times. * Note that, every fetch calls prepare, execute and fetch APIs. */ - public function benchFetchWithPrepare(){ - for( $i=0; $i<1000; $i++){ + public function benchFetchWithPrepare() + { + for( $i=0; $iconn, $this->tableName ); } } - public function dropTable(){ + public function dropTable() + { SqlsrvUtil::dropTable( $this->conn, $this->tableName ); } - public function disconnect(){ + public function disconnect() + { SqlsrvUtil::disconnect( $this->conn ); } } diff --git a/test/Performance/benchmark/sqlsrv/large/SqlsrvFetchLargeBench.php b/test/Performance/benchmark/sqlsrv/SqlsrvFetchLargeBench.php similarity index 73% rename from test/Performance/benchmark/sqlsrv/large/SqlsrvFetchLargeBench.php rename to test/Performance/benchmark/sqlsrv/SqlsrvFetchLargeBench.php index f7dc79fb..24dee142 100644 --- a/test/Performance/benchmark/sqlsrv/large/SqlsrvFetchLargeBench.php +++ b/test/Performance/benchmark/sqlsrv/SqlsrvFetchLargeBench.php @@ -2,30 +2,36 @@ use SqlsrvPerfTest\SqlsrvUtil; /** + * @Iterations(1) * @BeforeMethods({"connect", "setTableName" }) * @AfterMethods({ "disconnect"}) */ -class SqlsrvFetchLargeBench{ +class SqlsrvFetchLargeBench +{ private $conn; private $tableName; - public function setTableName(){ + public function setTableName() + { //Assumes the table is already populated with data $this->tableName = "LargeDB.dbo.datatypes"; } - public function connect(){ + public function connect() + { $this->conn = SqlsrvUtil::connect(); } /* * Each iteration calls prepare, execute and fetch APIs to fetch the already populdated data */ - public function benchFetchWithPrepare(){ + public function benchFetchWithPrepare() + { SqlsrvUtil::fetchWithPrepare( $this->conn, $this->tableName ); } - public function disconnect(){ + public function disconnect() + { SqlsrvUtil::disconnect( $this->conn ); } } diff --git a/test/Performance/benchmark/sqlsrv/regular/SqlsrvInsertBench.php b/test/Performance/benchmark/sqlsrv/SqlsrvInsertBench.php similarity index 65% rename from test/Performance/benchmark/sqlsrv/regular/SqlsrvInsertBench.php rename to test/Performance/benchmark/sqlsrv/SqlsrvInsertBench.php index 43a451fd..1d1c2a9f 100644 --- a/test/Performance/benchmark/sqlsrv/regular/SqlsrvInsertBench.php +++ b/test/Performance/benchmark/sqlsrv/SqlsrvInsertBench.php @@ -1,46 +1,56 @@ tableName = "datatypes_".rand(); } - public function connect(){ + public function connect() + { $this->conn = SqlsrvUtil::connect(); } - public function createTable(){ + public function createTable() + { SqlsrvUtil::createCRUDTable( $this->conn, $this->tableName ); } - public function generateInsertValues(){ + public function generateInsertValues() + { $this->insertValues = SqlsrvUtil::generateInsertValues(); } /** * Each iteration inserts 1000 rows into the table. * Note that, every insertion calls prepare, bindParam and execute APIs. */ - public function benchInsertWithPrepare(){ - for( $i=0; $i<1000; $i++ ){ + public function benchInsertWithPrepare() + { + for( $i=0; $iconn, $this->tableName, $this->insertValues ); } } - public function dropTable(){ + public function dropTable() + { SqlsrvUtil::dropTable( $this->conn, $this->tableName ); } - public function disconnect(){ + public function disconnect() + { SqlsrvUtil::disconnect( $this->conn ); } } diff --git a/test/Performance/benchmark/sqlsrv/regular/SqlsrvSelectVersionBench.php b/test/Performance/benchmark/sqlsrv/SqlsrvSelectVersionBench.php similarity index 68% rename from test/Performance/benchmark/sqlsrv/regular/SqlsrvSelectVersionBench.php rename to test/Performance/benchmark/sqlsrv/SqlsrvSelectVersionBench.php index 9567a093..8f640460 100644 --- a/test/Performance/benchmark/sqlsrv/regular/SqlsrvSelectVersionBench.php +++ b/test/Performance/benchmark/sqlsrv/SqlsrvSelectVersionBench.php @@ -2,24 +2,29 @@ use SqlsrvPerfTest\SqlsrvUtil; /** + * @Iterations(10000) * @BeforeMethods({"connect"}) * @AfterMethods({"disconnect"}) */ -class SqlsrvSelectVersionBench{ +class SqlsrvSelectVersionBench +{ private $conn; - public function connect(){ + public function connect() + { $this->conn = SqlsrvUtil::connect(); } /* * Each iteration calls execDirect API to fetch @@Version */ - public function benchSelectVersion(){ + public function benchSelectVersion() + { $version = SqlsrvUtil::selectVersion( $this->conn ); } - public function disconnect(){ + public function disconnect() + { SqlsrvUtil::disconnect( $this->conn ); } } diff --git a/test/Performance/benchmark/sqlsrv/regular/SqlsrvUpdateBench.php b/test/Performance/benchmark/sqlsrv/SqlsrvUpdateBench.php similarity index 68% rename from test/Performance/benchmark/sqlsrv/regular/SqlsrvUpdateBench.php rename to test/Performance/benchmark/sqlsrv/SqlsrvUpdateBench.php index 806c336a..de86cc82 100644 --- a/test/Performance/benchmark/sqlsrv/regular/SqlsrvUpdateBench.php +++ b/test/Performance/benchmark/sqlsrv/SqlsrvUpdateBench.php @@ -1,11 +1,13 @@ tableName = "datatypes_".rand(); } - public function connect(){ + public function connect() + { $this->conn = SqlsrvUtil::connect(); } - public function createTable(){ + public function createTable() + { SqlsrvUtil::createCRUDTable( $this->conn, $this->tableName ); } - public function generateInsertValues(){ + public function generateInsertValues() + { $this->insertValues = SqlsrvUtil::generateInsertValues(); } - public function insertWithPrepare(){ + public function insertWithPrepare() + { SqlsrvUtil::insertWithPrepare( $this->conn, $this->tableName, $this->insertValues ); } - public function generateUpdateValues(){ + public function generateUpdateValues() + { $this->updateValues = SqlsrvUtil::generateUpdateValues(); } - public function generateUpdateParams(){ + public function generateUpdateParams() + { $this->updateParams = SqlsrvUtil::generateUpdateParams(); } /** * Each iteration inserts a row into the table, updateWithPrepare() updates that row 1000 times. * Note that, every update calls prepare, bindParam and execute APIs. */ - public function benchUpdateWithPrepare(){ - for( $i=0; $i<1000; $i++ ){ + public function benchUpdateWithPrepare() + { + for( $i=0; $iconn, $this->tableName, $this->updateValues, $this->updateParams ); } } - public function dropTable(){ + public function dropTable() + { SqlsrvUtil::dropTable( $this->conn, $this->tableName ); } - public function disconnect(){ + public function disconnect() + { SqlsrvUtil::disconnect( $this->conn ); } diff --git a/test/Performance/lib/CRUDBaseBenchmark.php b/test/Performance/lib/CRUDBaseBenchmark.php new file mode 100644 index 00000000..b8c07de5 --- /dev/null +++ b/test/Performance/lib/CRUDBaseBenchmark.php @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/test/Performance/lib/PDOSqlsrvUtil.php b/test/Performance/lib/PDOSqlsrvUtil.php index 2e82a476..d553b1c4 100644 --- a/test/Performance/lib/PDOSqlsrvUtil.php +++ b/test/Performance/lib/PDOSqlsrvUtil.php @@ -2,32 +2,41 @@ namespace PDOSqlsrvPerfTest; use PDO; -class PDOSqlsrvUtil{ +class PDOSqlsrvUtil +{ - public static function connect(){ + public static $loopsPerCRUDIter = 100; + + public static function connect() + { require dirname(__FILE__).DIRECTORY_SEPARATOR.'connect.php'; - try{ + try + { $conn = new PDO( "sqlsrv:Server=$server; Database=$database; ConnectionPooling=$pooling; MultipleActiveResultSets=$mars" , $uid, $pwd ); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); return $conn; } - catch( PDOException $e ){ + catch( PDOException $e ) + { var_dump( $e ); exit; } } - public static function disconnect( $conn ){ + public static function disconnect( $conn ) + { $conn = null; } - public static function selectVersion( $conn ){ + public static function selectVersion( $conn ) + { $sql = "SELECT @@Version"; $stmt = self::query( $conn, $sql ); return self::fetch( $stmt ); } - public static function createDbTableProc( $conn, $databaseName, $tableName, $procName ){ + public static function createDbTableProc( $conn, $databaseName, $tableName, $procName ) + { $tableParams = "id INTEGER, name VARCHAR(32), value INTEGER, start_date DATE, time_added TIMESTAMP, set_time TIME(7)"; $procParams = "@id INTEGER, @name VARCHAR(32)"; $procTextBase = "SET NOCOUNT ON; SELECT id, name, value FROM $databaseName.$tableName WHERE id = @id AND name = @name"; @@ -37,7 +46,8 @@ class PDOSqlsrvUtil{ self::createStoredProc( $conn, $procName, $procParams, $procTextBase ); } - public static function generateInsertValues(){ + public static function generateInsertValues() + { $vcharVal = "test string"; $nvcharVal = "wstring"; $intVal = 3; @@ -52,7 +62,8 @@ class PDOSqlsrvUtil{ return $values; } - public static function generateUpdateValues(){ + public static function generateUpdateValues() + { $vcharVal = "test string updated"; $nvcharVal = "wstring updated"; $intVal = 5; @@ -67,7 +78,8 @@ class PDOSqlsrvUtil{ return $updatedValues; } - public static function generateUpdateParams(){ + public static function generateUpdateParams() + { $fieldNames = array( "vstring", "nvstring", @@ -81,41 +93,47 @@ class PDOSqlsrvUtil{ "dtoffset"); $params = ""; - foreach( $fieldNames as $fieldName ){ + foreach( $fieldNames as $fieldName ) + { $params = $params.$fieldName."=?,"; } $params = rtrim($params,", "); return $params; } - public static function insertWithPrepare( $conn, $tableName, $values ){ + public static function insertWithPrepare( $conn, $tableName, $values ) + { $sql = "INSERT INTO $tableName VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; $stmt = self::prepare( $conn, $sql ); self::bindParams( $stmt, $values ); self::execute( $stmt ); } - public static function fetchWithPrepare( $conn, $tableName ){ + public static function fetchWithPrepare( $conn, $tableName ) + { $sql = "SELECT * FROM $tableName"; $stmt = self::prepare( $conn, $sql ); self::execute( $stmt ); while ( $row = self::fetch( $stmt )){} } - public static function deleteWithPrepare( $conn, $tableName ){ + public static function deleteWithPrepare( $conn, $tableName ) + { $sql = "DELETE TOP (1) FROM $tableName"; $stmt = self::prepare( $conn, $sql ); self::execute( $stmt ); } - public static function updateWithPrepare( $conn, $tableName, $updateValues, $params ){ + public static function updateWithPrepare( $conn, $tableName, $updateValues, $params ) + { $sql = "UPDATE $tableName SET ".$params; $stmt = self::prepare( $conn, $sql ); self::bindParams( $stmt, $updateValues ); self::execute( $stmt ); } - private function bindParams( $stmt, $values ){ + private function bindParams( $stmt, $values ) + { //This functionn assumes the fields are from createCRUDTable() self::bindParam( $stmt, 1, $values[0], PDO::PARAM_STR); self::bindParam( $stmt, 2, $values[1], PDO::PARAM_STR); @@ -129,7 +147,8 @@ class PDOSqlsrvUtil{ self::bindParam( $stmt, 10, $values[9], PDO::PARAM_STR); } - public static function createCRUDTable( $conn, $tableName ){ + public static function createCRUDTable( $conn, $tableName ) + { $fields = array( "vstring" => "VARCHAR(64)", "nvstring" => "NVARCHAR(64)", @@ -142,86 +161,106 @@ class PDOSqlsrvUtil{ "vbin" => "VARBINARY", "dtoffset" => "DATETIMEOFFSET"); $params = ""; - foreach( $fields as $fieldName => $type ){ + foreach( $fields as $fieldName => $type ) + { $params .= $fieldName." ".$type.","; } $params = rtrim($params,", "); self::createTable( $conn, $tableName, $params ); } - private function createDatabase( $conn, $dbName ){ + private function createDatabase( $conn, $dbName ) + { $sql = "CREATE DATABASE $dbName"; $conn->exec( $sql ); } - public static function dropDatabase( $conn, $dbName ){ + public static function dropDatabase( $conn, $dbName ) + { $sql = "USE MASTER;DROP DATABASE $dbName"; $conn->exec( $sql ); } - public static function createTable( $conn, $tableName, $params ){ + public static function createTable( $conn, $tableName, $params ) + { $sql = "CREATE TABLE $tableName ($params)"; $conn->exec( $sql ); } - public static function dropTable( $conn, $tableName ){ + public static function dropTable( $conn, $tableName ) + { $sql = "DROP TABLE $tableName"; $conn->exec( $sql ); } - private function useDatabase( $conn, $dbName ){ + private function useDatabase( $conn, $dbName ) + { $sql = "USE $dbName"; $conn->exec( $sql ); } - private function createStoredProc( $conn, $procName, $params, $text ){ + private function createStoredProc( $conn, $procName, $params, $text ) + { $sql = "CREATE PROCEDURE $procName $params AS $text"; $conn->exec( $sql ); } - private function dropStoredProc( $conn, $procName ){ + private function dropStoredProc( $conn, $procName ) + { $sql = "DROP PROCEDURE $procName"; $conn->exec( $sql ); } - private function query( $conn, $sql ){ - try{ + private function query( $conn, $sql ) + { + try + { return $conn->query( $sql ); } - catch( PDOException $e ){ + catch( PDOException $e ) + { var_dump( $e ); exit; } } - private function fetch( $stmt ){ + private function fetch( $stmt ) + { return $stmt->fetch(); } - private function prepare( $conn, $sql ){ - try{ + private function prepare( $conn, $sql ) + { + try + { $stmt = $conn->prepare( $sql ); - if( $stmt === false ){ + if( $stmt === false ) + { die( "Failed to prepare\n"); } return $stmt; } - catch( PDOException $e ){ + catch( PDOException $e ) + { var_dump( $e ); exit; } } - private function execute( $stmt ){ + private function execute( $stmt ) + { $ret = $stmt->execute(); - if( $ret === false ){ + if( $ret === false ) + { die( "Failed to execute\n" ); } } - private function bindParam( $stmt, $index, $value, $type ){ + private function bindParam( $stmt, $index, $value, $type ) + { $ret = $stmt->bindParam( $index, $value, $type ); - if ( $ret === false){ + if ( $ret === false) + { die( "Faild to bind\n"); } } diff --git a/test/Performance/lib/SqlsrvUtil.php b/test/Performance/lib/SqlsrvUtil.php index f2a73533..4c8091b5 100644 --- a/test/Performance/lib/SqlsrvUtil.php +++ b/test/Performance/lib/SqlsrvUtil.php @@ -2,35 +2,45 @@ namespace SqlsrvPerfTest; -class SqlsrvUtil{ +class SqlsrvUtil +{ + + public static $loopsPerCRUDIter = 100; - public static function connect(){ + public static function connect() + { require dirname(__FILE__).DIRECTORY_SEPARATOR.'connect.php'; $options = array( "Database"=>$database, "UID"=>$uid, "PWD"=>$pwd, "ConnectionPooling"=>$pooling, "MultipleActiveResultSets"=>$mars ); $conn = sqlsrv_connect( $server, $options ); - if ( $conn === false ){ + if ( $conn === false ) + { die( print_r( sqlsrv_errors(), true)); } return $conn; } - public static function disconnect( $conn ){ - if ( $conn === false || $conn === null ){ + public static function disconnect( $conn ) + { + if ( $conn === false || $conn === null ) + { die( print_r( "Invalid connection resource\n")); } $ret = sqlsrv_close( $conn ); - if ( $ret === false ){ + if ( $ret === false ) + { die( print_r( sqlsrv_errors(), true)); } } - public static function selectVersion( $conn ){ + public static function selectVersion( $conn ) + { $sql = "SELECT @@Version"; $stmt = self::query( $conn, $sql ); return self::fetchArray( $stmt ); } - public static function createDbTableProc( $conn, $databaseName, $tableName, $procName ){ + public static function createDbTableProc( $conn, $databaseName, $tableName, $procName ) + { $tableParams = "id INTEGER, name VARCHAR(32), value INTEGER, start_date DATE, time_added TIMESTAMP, set_time TIME(7)"; $procParams = "@id INTEGER, @name VARCHAR(32)"; $procTextBase = "SET NOCOUNT ON; SELECT id, name, value FROM $databaseName.$tableName WHERE id = @id AND name = @name"; @@ -40,7 +50,8 @@ class SqlsrvUtil{ self::createStoredProc( $conn, $procName, $procParams, $procTextBase ); } - public static function generateInsertValues(){ + public static function generateInsertValues() + { $vcharVal = "test string"; $nvcharVal = "wstring"; $intVal = 3; @@ -55,7 +66,8 @@ class SqlsrvUtil{ return $values; } - public static function generateUpdateValues(){ + public static function generateUpdateValues() + { $vcharVal = "test string updated"; $nvcharVal = "wstring updated"; $intVal = 5; @@ -70,7 +82,8 @@ class SqlsrvUtil{ return $updatedValues; } - public static function generateUpdateParams(){ + public static function generateUpdateParams() + { $fieldNames = array( "vstring", "nvstring", @@ -84,33 +97,38 @@ class SqlsrvUtil{ "dtoffset"); $params = ""; - foreach( $fieldNames as $fieldName ){ + foreach( $fieldNames as $fieldName ) + { $params = $params.$fieldName."=?,"; } $params = rtrim($params,", "); return $params; } - public static function insertWithPrepare( $conn, $tableName, $values ){ + public static function insertWithPrepare( $conn, $tableName, $values ) + { $sql = "INSERT INTO $tableName VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; $stmt = self::prepare( $conn, $sql, $values ); self::execute( $stmt ); } - public static function updateWithPrepare( $conn, $tableName, $updateValues, $params ){ + public static function updateWithPrepare( $conn, $tableName, $updateValues, $params ) + { $sql = "UPDATE $tableName SET ".$params; $stmt = self::prepare( $conn, $sql, $updateValues ); self::execute( $stmt ); } - public static function fetchWithPrepare( $conn, $tableName ){ + public static function fetchWithPrepare( $conn, $tableName ) + { $sql = "SELECT * FROM $tableName"; $stmt = self::prepare( $conn, $sql, array()); self::execute( $stmt ); while( $row = self::fetchArray( $stmt ) ) {} } - public static function createCRUDTable( $conn, $tableName ){ + public static function createCRUDTable( $conn, $tableName ) + { $fields = array( "vstring" => "VARCHAR(64)", "nvstring" => "NVARCHAR(64)", @@ -123,108 +141,131 @@ class SqlsrvUtil{ "vbin" => "VARBINARY", "dtoffset" => "DATETIMEOFFSET"); $params = ""; - foreach( $fields as $fieldName => $type ){ + foreach( $fields as $fieldName => $type ) + { $params .= $fieldName." ".$type.","; } $params = rtrim($params,", "); self::createTable( $conn, $tableName, $params ); } - public static function query( $conn, $sql ){ + public static function query( $conn, $sql ) + { $stmt = sqlsrv_query( $conn, $sql ); - if( $stmt === false ){ + if( $stmt === false ) + { die( print_r( sqlsrv_errors(), true)); } return $stmt; } - public static function fetch( $stmt ){ + public static function fetch( $stmt ) + { $ret = sqlsrv_fetch( $stmt ); - if( $ret === false ){ + if( $ret === false ) + { die( print_r( sqlsrv_errors(), true)); } return $ret; } - public static function fetchArray( $stmt ){ + public static function fetchArray( $stmt ) + { $row = sqlsrv_fetch_array( $stmt ); - if ( $row === false ){ + if ( $row === false ) + { die( print_r( sqlsrv_errors(), true)); } return $row; } - public static function getField( $stmt, $index ){ + public static function getField( $stmt, $index ) + { return sqlsrv_get_field( $stmt, $index ); } - private function createDatabase( $conn, $dbName ){ + private function createDatabase( $conn, $dbName ) + { $sql = "CREATE DATABASE $dbName"; self::query( $conn, $sql ); } - public static function dropDatabase( $conn, $dbName ){ + public static function dropDatabase( $conn, $dbName ) + { $sql = "USE MASTER;DROP DATABASE $dbName"; self::query( $conn, $sql ); } - public static function createTable( $conn, $tableName, $params ){ + public static function createTable( $conn, $tableName, $params ) + { $sql = "CREATE TABLE $tableName ($params)"; self::query( $conn, $sql ); } - public static function dropTable( $conn, $tableName ){ + public static function dropTable( $conn, $tableName ) + { $sql = "DROP TABLE $tableName"; self::query( $conn, $sql ); } - private function useDatabase( $conn, $dbName ){ + private function useDatabase( $conn, $dbName ) + { $sql = "USE $dbName"; self::query( $conn, $sql ); } - private function createStoredProc( $conn, $procName, $params, $text ){ + private function createStoredProc( $conn, $procName, $params, $text ) + { $sql = "CREATE PROCEDURE $procName $params AS $text"; self::query( $conn, $sql ); } - private function dropStoredProc( $conn, $procName ){ + private function dropStoredProc( $conn, $procName ) + { $sql = "DROP PROCEDURE $procName"; self::query( $conn, $sql ); } - private function insert( $conn, $tableName, $values ){ + private function insert( $conn, $tableName, $values ) + { $sql = "INSERT INTO $tableName values ($values)"; self::query( $conn, $sql ); } - private function update( $conn, $tableName, $params, $condition ){ + private function update( $conn, $tableName, $params, $condition ) + { $sql = "UPDATE $tableName SET $params WHERE $condition"; self::query( $sql ); } - public function delete( $conn, $tableName){ + public function delete( $conn, $tableName) + { $sql = "DELETE TOP (1) FROM $tableName"; self::query( $conn, $sql ); } - public function deleteWithPrepare( $conn, $tableName ){ + public function deleteWithPrepare( $conn, $tableName ) + { $sql = "DELETE TOP (1) FROM $tableName"; $stmt = self::prepare( $conn, $sql, array() ); self::execute( $stmt ); } - private function prepare( $conn, $sql, $params ){ + private function prepare( $conn, $sql, $params ) + { $stmt = sqlsrv_prepare( $conn, $sql, $params ); - if( $stmt === false ){ + if( $stmt === false ) + { die( print_r( sqlsrv_errors(), true)); } return $stmt; } - public function execute( $stmt ){ + public function execute( $stmt ) + { $ret = sqlsrv_execute( $stmt ); - if ( $ret === false ){ + if ( $ret === false ) + { die( print_r( sqlsrv_errors(), true)); } } diff --git a/test/Performance/lib/result_db.php b/test/Performance/lib/result_db.php new file mode 100644 index 00000000..79415bff --- /dev/null +++ b/test/Performance/lib/result_db.php @@ -0,0 +1,6 @@ + diff --git a/test/Performance/report.sql b/test/Performance/report.sql index 859e769a..8023d6ac 100644 --- a/test/Performance/report.sql +++ b/test/Performance/report.sql @@ -1,8 +1,9 @@ --The script can be run to read the results. You can filter out the results ran on a certain date by changing the date at the end. +DECLARE @convByteToMegabyte int = 1048576 select t1.ResultId, Test, Client, Server, Driver, Duration, Memory, Success, Team, StartTime from ( select pr.ResultId, pr.Success, pt.TestName as Test, cl.HostName as Client, srv.HostName as Server, -tm.TeamName as Team, st.value as Driver, bi.value as Duration, bi2.value as Memory, dt.value as StartTime from +tm.TeamName as Team, st.value as Driver, bi.value as Duration, CAST(bi2.value AS decimal(10,2))/@convByteToMegabyte as Memory, dt.value as StartTime from KeyValueTableBigInt bi, KeyValueTableBigInt bi2, KeyValueTableString st, @@ -20,5 +21,4 @@ and cl.ClientId = pr.ClientId and pt.TestId = pr.TestId and tm.TeamId = pr.TeamId and srv.ServerId = pr.ServerId -) t1 where StartTime like '%2017-06-23%' - +) t1 where StartTime like '%2017-06-23%' \ No newline at end of file diff --git a/test/Performance/run-perf_tests.py b/test/Performance/run-perf_tests.py index 0821011e..077afa26 100644 --- a/test/Performance/run-perf_tests.py +++ b/test/Performance/run-perf_tests.py @@ -25,19 +25,18 @@ from time import strftime import hashlib """ - Paths to current benchmarks. These constants should be modified if there are any changes in folder structure of the project. "regular" folder contains the benchmarks that can be run for any iterations. "large" folder contains the benchmarks ( currently the benchmark that fetches large amount of data ) that take long time to run and meant to have less number of iterations than the regular ones. + Paths to current benchmarks. These constants should be modified if there are any changes in folder structure of the project. """ -sqlsrv_regular_path = "benchmark" + os.sep + "sqlsrv" + os.sep + "regular" -sqlsrv_large_path = "benchmark" + os.sep + "sqlsrv" + os.sep + "large" -pdo_regular_path = "benchmark" + os.sep + "pdo_sqlsrv" + os.sep + "regular" -pdo_large_path = "benchmark" + os.sep + "pdo_sqlsrv" + os.sep + "large" +sqlsrv_path = "benchmark" + os.sep + "sqlsrv" +pdo_path = "benchmark" + os.sep + "pdo_sqlsrv" """ Path to the connect.php file that contains test database credentials. Note that, the benchmarks are run against this database and it is different from Result database. """ connect_file = "lib" + os.sep + "connect.php" connect_file_bak = connect_file + ".bak" +result_file = "lib" + os.sep + "result_db.php" """ Global data format used across the script @@ -139,18 +138,17 @@ def get_test_name( name ): } return test_name_dict[ name ] -def get_run_command( path_to_tests, iterations, dump_file ): +def get_run_command( path_to_tests, dump_file ): """ This module returns the command to run the tests Args: path_to_tests (str): The folder that contains the tests to be run - iterations (str): Number of iterations dump_file (str): The name of the XML file to output the results Returns: The command to run the tests """ - command = "vendor" + os.sep + "bin" + os.sep + "phpbench run {0} --iterations {1} --dump-file={2}" - return command.format( path_to_tests, iterations, dump_file ) + command = "vendor" + os.sep + "bin" + os.sep + "phpbench run {0} --dump-file={1}" + return command.format( path_to_tests, dump_file ) def get_id( conn, id_field, table, name_field, value ): """ @@ -196,14 +194,14 @@ def get_id_no_quote( conn, id_field, table, name_field, value ): return id[0] return id -def get_test_database(): +def get_test_database( database_file ): """ This module reads test database details from connect.php and stores them into an instance of DB class Returns: A DB object that contains database credentials """ test_db = DB() - for line in open( connect_file ): + for line in open( database_file ): if "server" in line: test_db.server_name = line.split("=")[1].strip()[1:-2] elif "database" in line: @@ -611,21 +609,23 @@ def disable_pooling(): copyfile( odbcinst_bak, odbcinst ) os.remove( odbcinst_bak ) -def run_tests( iterations, iterations_large ): +def run_tests( php_driver, test_name ): """ This module runs the tests using PHPBench Args: - iterations (int): Number of iterations the tests in "regular" folder are run for - iterations_large (int): Number of iterations the tests in "large" folder are run for + php_driver (str): Name of the driver to be tested: sqlsrv, pdo_sqlsrv, or both + test_name (str): File name of the test or all Returns: N/A """ print("Running the tests...") - call( get_run_command( sqlsrv_regular_path, iterations, "sqlsrv-regular.xml" ), shell=True ) - call( get_run_command( sqlsrv_large_path, iterations_large, "sqlsrv-large.xml" ), shell=True ) - - call( get_run_command( pdo_regular_path, iterations, "pdo_sqlsrv-regular.xml" ), shell=True ) - call( get_run_command( pdo_large_path, iterations_large, "pdo_sqlsrv-large.xml" ), shell=True ) + add_to_path = '' + if test_name != 'all': + add_to_path = os.sep + test_name + if php_driver == 'sqlsrv' or php_driver == 'both': + call( get_run_command( sqlsrv_path + add_to_path, "sqlsrv-results.xml" ), shell=True ) + if php_driver == 'pdo_sqlsrv' or php_driver == 'both': + call( get_run_command( pdo_path + add_to_path, "pdo_sqlsrv-results.xml" ), shell=True ) def parse_results( dump_file ): """ @@ -656,6 +656,7 @@ def parse_results( dump_file ): # If the bechmark was run successfully, parse the results. This is where you would add code to parse more details about the benchmark. else: xml_result.success = 1 + # convert microseconds to seconds xml_result.duration = int( round( int( benchmark[0][0].find( 'stats' ).get( 'sum' )) / 1000000 )) iterations = benchmark[0][0].findall( 'iteration' ) xml_result.iterations = len( iterations ) @@ -685,6 +686,11 @@ def parse_and_store_results( dump_file, test_db, result_db, platform, driver, st Returns: N/A """ + # Check if the xml file actually exist + if not os.path.exists(dump_file): + print(dump_file + " does not exist") + return + # Connect to the Result Database conn = connect( result_db ) @@ -742,20 +748,14 @@ def parse_and_store_results_all( test_db, result_db, platform, start_time, mars, """ print("Parsing and storing the results...") - parse_and_store_results( "sqlsrv-regular.xml", test_db, result_db, platform, "sqlsrv", start_time, mars, pooling ) - parse_and_store_results( "sqlsrv-large.xml", test_db, result_db, platform, "sqlsrv", start_time, mars, pooling ) - parse_and_store_results( "pdo_sqlsrv-regular.xml", test_db, result_db, platform, "pdo_sqlsrv", start_time, mars, pooling ) - parse_and_store_results( "pdo_sqlsrv-large.xml", test_db, result_db, platform, "pdo_sqlsrv", start_time, mars, pooling ) + parse_and_store_results( "sqlsrv-results.xml", test_db, result_db, platform, "sqlsrv", start_time, mars, pooling ) + parse_and_store_results( "pdo_sqlsrv-results.xml", test_db, result_db, platform, "pdo_sqlsrv", start_time, mars, pooling ) if __name__ == '__main__': parser = argparse.ArgumentParser() - parser.add_argument( '-platform', '--PLATFORM', required=True, help='The name of the platform the tests run on' ) - parser.add_argument( '-iterations', '--ITERATIONS', required=True, help='Number of iterations for regular tests', type=int ) - parser.add_argument( '-iterations-large', '--ITERATIONS_LARGE', required=True, help='Number of iterations for regular tests', type=int ) - parser.add_argument( '-result-server', '--RESULT_SERVER', required=True, help='IP address of the Result Server' ) - parser.add_argument( '-result-db', '--RESULT_DB', required=True, help='Name of the Result Database' ) - parser.add_argument( '-result-uid', '--RESULT_UID', required=True, help='Username to connect to the Result Database' ) - parser.add_argument( '-result-pwd', '--RESULT_PWD', required=True, help='Password to connect to the Result Database' ) + parser.add_argument( '-platform', '--PLATFORM', required=True, help='The name of the platform the tests run on' ) + parser.add_argument( '-php-driver', '--PHP_DRIVER', default='both', help='Name of the PHP driver: sqlsrv, pdo_sqlsrv or both') + parser.add_argument( '-testname', '--TESTNAME', default='all', help='File name for only one test or all' ) args = parser.parse_args() # Start time is recorded only in the beginning of this script execution. So it is not benchmark specific. @@ -764,12 +764,12 @@ if __name__ == '__main__': print( "Start time: " + start_time ) validate_platform( args.PLATFORM ) - result_db = DB( args.RESULT_SERVER, args.RESULT_DB, args.RESULT_UID, args.RESULT_PWD ) - test_db = get_test_database() + result_db = get_test_database( result_file ) + test_db = get_test_database( connect_file ) print("Running the tests with default settings...") - run_tests( args.ITERATIONS, args.ITERATIONS_LARGE ) + run_tests( args.PHP_DRIVER, args.TESTNAME ) parse_and_store_results_all( test_db, result_db, args.PLATFORM, start_time, 0, 0 ) """ The following lines are commented out, because it already takes a long time to run the tests with the default settings. @@ -777,17 +777,17 @@ if __name__ == '__main__': print("Running the tests with MARS ON...") enable_mars() - run_tests( args.ITERATIONS, args.ITERATIONS_LARGE ) + run_tests( args.PHP_DRIVER, args.TESTNAME ) parse_and_store_results_all( test_db, result_db, args.PLATFORM, start_time, 1, 0 ) disable_mars() print("Running the tests with Pooling ON...") enable_pooling() - run_tests( args.ITERATIONS, args.ITERATIONS_LARGE ) + run_tests( args.PHP_DRIVER, args.TESTNAME ) parse_and_store_results_all( test_db, result_db, args.PLATFORM, start_time, 0, 1 ) disable_pooling() """ exit() - \ No newline at end of file +