-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathkv-sqlite3-devshm-file.inc
More file actions
50 lines (43 loc) · 1.31 KB
/
kv-sqlite3-devshm-file.inc
File metadata and controls
50 lines (43 loc) · 1.31 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
<?php
/**
* php safe options - only tests mod sqlite3
* Php 5.3+
*/
/** ---------------------------------- Tests functions -------------------------------------------- */
// ------------------------- INTL tests -----------------------
/**
* @since 5.0
*/
function test_39_08_kvs_sqlite3_devshm_file()
{
global $testsLoopLimits, $totalOps, $emptyResult;
global $sqlite3_dbpath, $debugMode;
if (!is_file('kvstorage-sqlite3.inc')){
if ($debugMode) print("storage no file");
return $emptyResult;
}
if (!class_exists('SQLite3')){
if ($debugMode) print("no class");
return $emptyResult;
}
if (is_dir('/dev/shm')) $sqlite3_dbpath='/dev/shm/kvstorage.sqlite3';
if ($debugMode) print("now db path is: $sqlite3_dbpath");
include_once('kvstorage-sqlite3.inc');
$kvstorage=new KVStorageSqlite3();
$kvstorage->open($sqlite3_dbpath);
if (!$kvstorage->available){
if ($debugMode) print("storage noavail");
return $emptyResult;
}
$count = $testsLoopLimits['39_08_kvs_sqlite3_devshm_file'];
$time_start = get_microtime();
for ($i = 0; $i < $count; $i++) {
$num = number_format($i / 100., 2, '.', '');
$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());
}