Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
Practical-Cryptdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Zhaozhen
Practical-Cryptdb
Commits
b354238c
Commit
b354238c
authored
Jan 30, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use random str in test_layer
parent
7f05f8a6
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
44 additions
and
37 deletions
+44
-37
test_layer_DET_str.cc
debug/test_layer_DET_str.cc
+1
-1
test_layer_OPE_str.cc
debug/test_layer_OPE_str.cc
+1
-1
test_layer_RND_str.cc
debug/test_layer_RND_str.cc
+1
-1
test_layer_SWP.cc
debug/test_layer_SWP.cc
+1
-33
Makefrag
util/Makefrag
+1
-1
timer.cc
util/timer.cc
+28
-0
timer.hh
util/timer.hh
+11
-0
No files found.
debug/test_layer_DET_str.cc
View file @
b354238c
...
@@ -138,7 +138,7 @@ main(int argc,char**argv) {
...
@@ -138,7 +138,7 @@ main(int argc,char**argv) {
return
0
;
return
0
;
}
}
for
(
int
i
=
1
;
i
<=
100
;
i
++
)
{
for
(
int
i
=
1
;
i
<=
100
;
i
++
)
{
std
::
string
input
(
length
*
i
,
'a'
)
;
std
::
string
input
=
ggetpRandomName
(
length
*
i
)
;
Item
*
plain
=
getItemString
(
input
)
;
Item
*
plain
=
getItemString
(
input
)
;
control
(
ds
,
plain
,
num_of_tests
,
length
*
i
)
;
control
(
ds
,
plain
,
num_of_tests
,
length
*
i
)
;
}
}
...
...
debug/test_layer_OPE_str.cc
View file @
b354238c
...
@@ -131,7 +131,7 @@ main(int argc,char** argv) {
...
@@ -131,7 +131,7 @@ main(int argc,char** argv) {
}
}
for
(
int
i
=
1
;
i
<=
100
;
i
++
)
{
for
(
int
i
=
1
;
i
<=
100
;
i
++
)
{
std
::
string
input
(
length
*
i
,
'a'
);
std
::
string
input
=
ggetpRandomName
(
length
*
i
);
Item
*
plain
=
getItemString
(
input
);
Item
*
plain
=
getItemString
(
input
);
control
(
op
,
plain
,
num_of_tests
,
length
*
i
);
control
(
op
,
plain
,
num_of_tests
,
length
*
i
);
}
}
...
...
debug/test_layer_RND_str.cc
View file @
b354238c
...
@@ -142,7 +142,7 @@ main(int argc,char**argv) {
...
@@ -142,7 +142,7 @@ main(int argc,char**argv) {
}
}
for
(
int
i
=
1
;
i
<=
100
;
i
++
)
{
for
(
int
i
=
1
;
i
<=
100
;
i
++
)
{
std
::
string
input
(
length
*
i
,
'a'
);
std
::
string
input
=
ggetpRandomName
(
length
*
i
);
Item
*
plain
=
getItemString
(
input
);
Item
*
plain
=
getItemString
(
input
);
control
(
rs
,
plain
,
num_of_tests
,
length
*
i
);
control
(
rs
,
plain
,
num_of_tests
,
length
*
i
);
}
}
...
...
debug/test_layer_SWP.cc
View file @
b354238c
...
@@ -19,12 +19,6 @@
...
@@ -19,12 +19,6 @@
#include "util/onions.hh"
#include "util/onions.hh"
#include <sys/time.h>
#include <sys/time.h>
static
uint64_t
cur_usec
()
{
struct
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
return
((
uint64_t
)
tv
.
tv_sec
)
*
1000000
+
tv
.
tv_usec
;
}
using
std
::
cout
;
using
std
::
cout
;
using
std
::
cin
;
using
std
::
cin
;
using
std
::
endl
;
using
std
::
endl
;
...
@@ -37,33 +31,7 @@ static std::map<std::string, WrapperState*> clients;
...
@@ -37,33 +31,7 @@ static std::map<std::string, WrapperState*> clients;
//This connection mimics the behaviour of MySQL-Proxy
//This connection mimics the behaviour of MySQL-Proxy
Connect
*
globalConn
;
Connect
*
globalConn
;
static
std
::
string
getpRandomName
(
int
out_length
=
10
){
static
const
char
valids
[]
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
;
char
output
[
out_length
+
1
];
// std::function<bool()> wrap_srand =[](){srand(time(NULL)); return true;};
std
::
function
<
bool
()
>
wrap_srand
=
[](){
srand
(
cur_usec
());
return
true
;};
std
::
function
<
void
(
bool
)
>
do_nothing
=
[]
(
bool
b
)
{
return
;};
static
bool
danger_will_robinson
=
wrap_srand
();
do_nothing
(
danger_will_robinson
);
for
(
int
i
=
0
;
i
<
out_length
;
++
i
)
{
output
[
i
]
=
valids
[
rand
()
%
strlen
(
valids
)];
}
output
[
out_length
]
=
0
;
return
std
::
string
(
output
);
}
/*for each field, convert the format to FieldMeta_Wrapper*/
/*for each field, convert the format to FieldMeta_Wrapper*/
static
void
init
(){
static
void
init
(){
std
::
string
client
=
"192.168.1.1:1234"
;
std
::
string
client
=
"192.168.1.1:1234"
;
//one Wrapper per user.
//one Wrapper per user.
...
@@ -168,7 +136,7 @@ main(int argc,char**argv) {
...
@@ -168,7 +136,7 @@ main(int argc,char**argv) {
}
}
for
(
int
i
=
1
;
i
<=
100
;
i
++
)
{
for
(
int
i
=
1
;
i
<=
100
;
i
++
)
{
std
::
string
input
=
getpRandomName
(
length
*
i
);
std
::
string
input
=
g
g
etpRandomName
(
length
*
i
);
Item
*
plain
=
getItemString
(
input
);
Item
*
plain
=
getItemString
(
input
);
auto
res
=
tokenize
(
input
);
auto
res
=
tokenize
(
input
);
control
(
sw
,
plain
,
num_of_tests
,
length
*
i
,
res
->
size
());
control
(
sw
,
plain
,
num_of_tests
,
length
*
i
,
res
->
size
());
...
...
util/Makefrag
View file @
b354238c
OBJDIRS += util
OBJDIRS += util
UTILSRC := onions.cc cryptdb_log.cc ctr.cc util.cc version.cc constants.cc log.cc
UTILSRC := onions.cc cryptdb_log.cc ctr.cc util.cc version.cc constants.cc log.cc
timer.cc
all: $(OBJDIR)/libedbutil.so $(OBJDIR)/libedbutil.a
all: $(OBJDIR)/libedbutil.so $(OBJDIR)/libedbutil.a
...
...
util/timer.cc
0 → 100644
View file @
b354238c
#include "util/timer.hh"
#include <functional>
#include <string>
#include <string.h>
uint64_t
gcur_usec
(){
struct
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
return
((
uint64_t
)
tv
.
tv_sec
)
*
1000000
+
tv
.
tv_usec
;
}
std
::
string
ggetpRandomName
(
int
out_length
){
static
const
char
valids
[]
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
;
char
output
[
out_length
+
1
];
std
::
function
<
bool
()
>
wrap_srand
=
[](){
srand
(
gcur_usec
());
return
true
;};
std
::
function
<
void
(
bool
)
>
do_nothing
=
[]
(
bool
b
)
{
return
;};
static
bool
danger_will_robinson
=
wrap_srand
();
do_nothing
(
danger_will_robinson
);
for
(
int
i
=
0
;
i
<
out_length
;
++
i
)
{
output
[
i
]
=
valids
[
rand
()
%
strlen
(
valids
)];
}
output
[
out_length
]
=
0
;
return
std
::
string
(
output
);
}
util/timer.hh
View file @
b354238c
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
#include <sys/time.h>
#include <sys/time.h>
#include <time.h>
#include <time.h>
#include <stdint.h>
#include <string>
class
timer
{
class
timer
{
private
:
private
:
...
@@ -26,3 +28,12 @@ class timer {
...
@@ -26,3 +28,12 @@ class timer {
unsigned
long
start
;
unsigned
long
start
;
};
};
uint64_t
gcur_usec
();
std
::
string
ggetpRandomName
(
int
out_length
=
10
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment