diff --git a/api/http/cpp/example/Benchmark.cpp b/api/http/cpp/example/Benchmark.cpp new file mode 100644 index 0000000..e7621d1 --- /dev/null +++ b/api/http/cpp/example/Benchmark.cpp @@ -0,0 +1,118 @@ +#include "client.h" +#include +#include +#include +#include +#include +#include +using namespace std; +#define tnum 4000 +bool correctness = true; +pthread_mutex_t mutex; + +string int2string(int n) +{ + string s; + stringstream ss; + ss<>s; + return s; +} + + +struct MyThread_args{ + int num; + string sparql; + int rnum; +}; + +void* MyThread_run(void* thread_args) +{ + struct MyThread_args *args; + args = (struct MyThread_args *)thread_args; + CHttpClient hc; + string res; + int ret; + ret = hc.Get("http://172.31.222.94:9000/?operation=query&format=json&sparql="+args->sparql,res); + int m = 0; + for(int i = 0; isparql.length(); ++i) + { + if(args->sparql[i]=='?') + ++m; + if(args->sparql[i]=='{') + break; + } + int n = 0; + for(int i = 0; inum)+".txt"); + // f<rnum != Num) + correctness = false; + pthread_exit(NULL); +} +int main() +{ + int result[6] = {10, 14, 14, 199424, 33910, 1039}; + string* sparql = new string[6]; + sparql[0] = "select ?v0 where\ + {\ + ?v0 .\ + ?v0 .\ + ?v0 .\ + }"; + sparql[1] = "select ?v0 where\ + {\ + ?v0 .\ + }"; + sparql[2] = "select ?v2 where\ + {\ + ?v2 .\ + }"; + sparql[3] = "select ?v0 ?v2 where\ + {\ + ?v0 ?v2 .\ + }"; + sparql[4] = "select ?v0 ?v1 ?v2 where\ + {\ + ?v0 ?v2 .\ + ?v1 ?v2 .\ + }"; + sparql[5] = "select ?v0 ?v1 ?v2 ?v3 where\ + {\ + ?v0 ?v1 .\ + ?v0 ?v2 .\ + ?v0 ?v3 .\ + }"; + pthread_t qt[tnum]; + void *status; + struct MyThread_args args[tnum]; + for(int i = 0;i +#include +#include +#include "client.h" + +using namespace std; + +int main() +{ + CHttpClient hc; + string res; + int ret; + + //ret = hc.Get("http://172.31.222.94:9000/?operation=build&db_name=lubm&ds_path=data/LUBM_10.n3", res); + //cout<