All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
benchmark.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright 2008-2013 by Aerospike.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to
6  * deal in the Software without restriction, including without limitation the
7  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8  * sell copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20  * IN THE SOFTWARE.
21  ******************************************************************************/
22 #pragma once
23 
24 #include "aerospike/aerospike.h"
25 #include "aerospike/as_record.h"
26 #include "latency.h"
27 
28 typedef struct arguments_t {
29  char* host_string;
30  char** hosts;
32  int port;
33  const char* namespace;
34  const char* set;
35  int keys;
36  char bintype;
37  int binlen;
38  bool random;
39  bool init;
40  int init_pct;
41  int read_pct;
42  int threads;
47  bool debug;
48  bool latency;
51 } arguments;
52 
53 typedef struct clientdata_t {
54  const char* host;
55  const char* namespace;
56  const char* set;
57  const char* bin_name;
58 
59  cf_atomic64 period_begin;
60 
63 
65  cf_atomic32 write_count;
66  cf_atomic32 write_timeout_count;
67  cf_atomic32 write_error_count;
68 
70  cf_atomic32 read_count;
71  cf_atomic32 read_timeout_count;
72  cf_atomic32 read_error_count;
73 
74  cf_atomic32 current_key;
75  cf_atomic32 valid;
76  int32_t records;
77 
78  int port;
79  int threads;
81  int read_pct;
82  int binlen;
83  char bintype;
84 
85  bool random;
86  bool latency;
87  bool debug;
88 } clientdata;
89 
90 int run_benchmark(arguments* args);
93 int write_record(int key, clientdata* data);
94 int read_record(int key, clientdata* data);
95 int gen_value(arguments* args, as_bin_value* val);
96 bool is_stop_writes(aerospike* client, const char* host, int port, const char* namespace);
97 
98 void blog_line(const char* fmt, ...);
99 void blog_detail(as_log_level level, const char* fmt, ...);
100 void blog_detailv(as_log_level level, const char* fmt, va_list ap);
101 
102 #define blog(_fmt, _args...) { printf(_fmt, ## _args); }
103 #define blog_info(_fmt, _args...) { blog_detail(AS_LOG_LEVEL_INFO, _fmt, ## _args); }
104 #define blog_error(_fmt, _args...) { blog_detail(AS_LOG_LEVEL_ERROR, _fmt, ## _args); }
cf_atomic32 write_count
Definition: benchmark.h:65
int max_retries
Definition: benchmark.h:46
cf_atomic32 current_key
Definition: benchmark.h:74
cf_atomic32 read_count
Definition: benchmark.h:70
char bintype
Definition: benchmark.h:36
int host_count
Definition: benchmark.h:31
int threads
Definition: benchmark.h:42
const char * set
Definition: benchmark.h:55
bool is_stop_writes(aerospike *client, const char *host, int port, const char *namespace)
int read_pct
Definition: benchmark.h:81
cf_atomic32 valid
Definition: benchmark.h:75
int gen_value(arguments *args, as_bin_value *val)
bool debug
Definition: benchmark.h:87
cf_atomic32 write_error_count
Definition: benchmark.h:67
int read_record(int key, clientdata *data)
bool random
Definition: benchmark.h:85
latency write_latency
Definition: benchmark.h:64
cf_atomic32 write_timeout_count
Definition: benchmark.h:66
char * host_string
Definition: benchmark.h:29
bool debug
Definition: benchmark.h:47
int latency_shift
Definition: benchmark.h:50
int port
Definition: benchmark.h:78
bool random
Definition: benchmark.h:38
int binlen
Definition: benchmark.h:82
void blog_detailv(as_log_level level, const char *fmt, va_list ap)
const char * bin_name
Definition: benchmark.h:57
int binlen
Definition: benchmark.h:37
int run_benchmark(arguments *args)
int latency_columns
Definition: benchmark.h:49
bool latency
Definition: benchmark.h:48
int port
Definition: benchmark.h:32
cf_atomic64 period_begin
Definition: benchmark.h:59
cf_atomic32 read_timeout_count
Definition: benchmark.h:71
int linear_write(clientdata *data)
bool latency
Definition: benchmark.h:86
int throughput
Definition: benchmark.h:80
int read_timeout
Definition: benchmark.h:44
int init_pct
Definition: benchmark.h:40
int keys
Definition: benchmark.h:35
latency read_latency
Definition: benchmark.h:69
void blog_line(const char *fmt,...)
int random_read_write(clientdata *data)
aerospike client
Definition: benchmark.h:61
void blog_detail(as_log_level level, const char *fmt,...)
cf_atomic32 read_error_count
Definition: benchmark.h:72
int throughput
Definition: benchmark.h:43
char bintype
Definition: benchmark.h:83
bool init
Definition: benchmark.h:39
int read_pct
Definition: benchmark.h:41
const char * set
Definition: benchmark.h:33
int threads
Definition: benchmark.h:79
const char * host
Definition: benchmark.h:54
int32_t records
Definition: benchmark.h:76
int write_timeout
Definition: benchmark.h:45
as_bin_value fixed_value
Definition: benchmark.h:62
int write_record(int key, clientdata *data)
char ** hosts
Definition: benchmark.h:30