-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathkv-mysql-memory.inc
More file actions
51 lines (44 loc) · 1.2 KB
/
kv-mysql-memory.inc
File metadata and controls
51 lines (44 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* php safe options - only tests mod mysql
* Php 4.0+
*/
/** ---------------------------------- Tests functions -------------------------------------------- */
// ------------------------- INTL tests -----------------------
/**
* @since 4.0
*/
function test_45_03_kvs_mysql_memory()
{
global $testsLoopLimits, $totalOps, $emptyResult;
global $sqlite3_dbpath, $debugMode;
if (!is_file('kvstorage-mysql.inc')){
if ($debugMode) print("storage no file");
return $emptyResult;
}
if (!function_exists('mysql_query')){
if ($debugMode) print("no func");
return $emptyResult;
}
include_once('kvstorage-mysql.inc');
$kvstorage=new KVStorageMysql();
$kvstorage->engineName='MEMORY';
$kvstorage->open();
$kvstorage->drop();
$kvstorage->create();
if (!$kvstorage->available){
if ($debugMode) print("storage noavail");
return $emptyResult;
}
$count = $testsLoopLimits['45_03_kvs_mysql_memory'];
$time_start = get_microtime();
for ($i = 0; $i < $count; $i++) {
$num = $i / 100.;
$kvstorage->set($i, $num);
$v=$kvstorage->get($i);
$kvstorage->del($i);
}
$kvstorage->close();
$totalOps += $count;
return format_result_test(get_microtime() - $time_start, $count, mymemory_usage());
}