Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

153 implement a code generator to to automatically create all redis commands scaffolding arguments parsing and commands callbacks #170

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
68a9521
Add a json containing the specs for the scaffolding to generate
danielealbano Jul 24, 2022
e5c4280
Initial draft of the code generator for the Redis commands scaffolding
danielealbano Jul 24, 2022
9cdc235
Separate the struct containing the chunk_info sequence and their count
danielealbano Jul 24, 2022
b2a0324
Rename network_protocol_redis in module_redis in preparation to move …
danielealbano Jul 24, 2022
7011710
Rename network_protocol.c/h in module.c/h and move the files under a …
danielealbano Jul 24, 2022
9bd4bbe
Move the redis module under the modules folder
danielealbano Jul 24, 2022
b085b20
Move the prometheus module under the modules folder and rename all th…
danielealbano Jul 24, 2022
db06d30
Rename network_protocols in module_types
danielealbano Jul 24, 2022
4276938
Reorganize the configuration to move the modules away from the "netwo…
danielealbano Jul 24, 2022
8518f83
Update the config file to match the new structure
danielealbano Jul 24, 2022
8e390e4
Autogenerated commands never define command end
danielealbano Jul 24, 2022
7cc0796
Add initial code generation for the callbacks
danielealbano Jul 24, 2022
4bacda7
Add required headers for the auto generated commands callbacks
danielealbano Jul 24, 2022
52d46d3
Fix the basic auto generated command free
danielealbano Jul 24, 2022
fe7da94
The command table is now auto generated, drop the hardcoded one
danielealbano Jul 24, 2022
454cf97
Can't support sub arguments of sub arguments for now, drop the authen…
danielealbano Jul 24, 2022
878e0d4
Import the auto generated headers as needed and add the necessary str…
danielealbano Jul 24, 2022
f857b50
Add the automatic generation of the scaffolding to cmake via a custom…
danielealbano Jul 24, 2022
c1de375
Plenty of small fixes to the scaffolding auto generation, add a mecha…
danielealbano Jul 24, 2022
30b3037
Various improvements, add prep info for the parsing of the incoming data
danielealbano Jul 24, 2022
c2ea974
Rename modules in module and all the "network_protocol" or "protocol_…
danielealbano Jul 25, 2022
060c325
Callbacks for the command begin and free have been dropped in favour …
danielealbano Jul 25, 2022
e0b2443
Fix arguments, sub arguments and context generation and add fields of…
danielealbano Jul 25, 2022
3fb4cd1
Fix headers for cpp tests
danielealbano Jul 25, 2022
ed52dde
Refactor the scaffolding generator to spllit module_redis_autogenerat…
danielealbano Jul 28, 2022
88af86e
Add a component to handle the redis connections (send out ok messages…
danielealbano Jul 28, 2022
8d25d61
Refactor module_redis to take advantage of module_redis_context
danielealbano Jul 28, 2022
2bec0ec
C++ doesn't allow to OR plain ENUM values, add a wrapper for it
danielealbano Jul 28, 2022
73ed14b
Initial implementation of the tests for the module_redis_command comp…
danielealbano Jul 28, 2022
c909277
Style fixes for the scaffolding generator
danielealbano Jul 30, 2022
8ebbec2
Drop the generation of the callbacks for argument_stream_begin/data/e…
danielealbano Jul 30, 2022
08d6238
use uint64_t for unix timestamps to handle milliseconds properly
danielealbano Jul 30, 2022
2573a8d
Drop the code to generate the not required anymore callbacks (part 2)
danielealbano Jul 30, 2022
41c9075
Cleanup the autogenerated contexts
danielealbano Jul 30, 2022
ae90641
Correct the argument size calculation, add sub arguments, sub argumen…
danielealbano Jul 30, 2022
b9fdb12
Add automatic code generation to free the generated command contexts
danielealbano Jul 30, 2022
5fa66d0
Fix the command info table generation and add a flag to indicate if t…
danielealbano Jul 30, 2022
07fe7a6
Refactor the storage db to use sequence of chunks instead of having 2…
danielealbano Jul 30, 2022
66213bb
nit: In the slab allocator, if asked to allocate 0 byte return null
danielealbano Jul 30, 2022
2db2d9d
Update cmake to indicate all the files generated by the scaffolding g…
danielealbano Jul 30, 2022
e66900f
Add a macro to get the size of a member of a struct without having an…
danielealbano Jul 30, 2022
926c93a
Add the storage db to the connection context
danielealbano Jul 30, 2022
254f2bd
Restore the callback to free the command context as the auto generate…
danielealbano Jul 30, 2022
b62e8e7
Drop the unused callbacks and update the command info struct to match…
danielealbano Jul 30, 2022
c867b80
Update the argument struct to match the updated autogenerated one
danielealbano Jul 30, 2022
3068962
New command argument parser struct, added it to the connection contex…
danielealbano Jul 30, 2022
3318586
Always fill up the command argument parser context with zeros when th…
danielealbano Jul 30, 2022
0767f1b
Stub functions for the callbacks to handle the command arguments
danielealbano Jul 30, 2022
44f6228
Introduction of a function to build a token map, temporary, the map h…
danielealbano Jul 30, 2022
c24f182
Fix various bugs in the automatic dump of the command context
danielealbano Jul 30, 2022
975552a
Update module redis command
danielealbano Jul 30, 2022
baa5b3c
Pass the storage db onto the connection context, drop the callbacks f…
danielealbano Jul 30, 2022
91eb61c
Update test after renaming function
danielealbano Jul 30, 2022
dc31ec2
Update commands to include the amount of required arguments, if they …
danielealbano Jul 30, 2022
ff40ab5
Add some macro to catch errors at compile time
danielealbano Aug 8, 2022
4b13e75
Drop the key specs as they are unused but keep in the json as took qu…
danielealbano Aug 8, 2022
c1ba87e
Fix a bug in the slab allocator mem realloc which was preventing the …
danielealbano Aug 8, 2022
b084e59
Add some new wrapper functions to avoid code duplication in the stora…
danielealbano Aug 8, 2022
7c7619f
Reorganize module_redis_command_info to optimize memory consumption a…
danielealbano Aug 8, 2022
e18a9cd
Fix the argument processing flow, argument being has to be called bef…
danielealbano Aug 8, 2022
b62bc83
Drop command length, use string_len instead
danielealbano Aug 8, 2022
103133f
Improve automatic argument parsing implementation, still doesn't hand…
danielealbano Aug 8, 2022
f418a92
Minor performance optimization
danielealbano Aug 8, 2022
739c90b
Re-implement all the commands leveraging the automated argument parser
danielealbano Aug 8, 2022
7845f0f
key_specs dropped
danielealbano Aug 8, 2022
85bc6d7
Add support for long & short strings, differentiate in commands.json …
danielealbano Aug 8, 2022
0745df1
Minor headers cleanup
danielealbano Aug 8, 2022
4fff9dd
Rename the benchmarks and the tests for the multi producer multi cons…
danielealbano Aug 11, 2022
6236f90
Fix typo
danielealbano Aug 11, 2022
3094efe
Implement a new hashtable single producer single consumer used intern…
danielealbano Aug 11, 2022
99431d3
Add the hash fnv1 used by hashtable spsc
danielealbano Aug 11, 2022
346d380
Switch some functions to static always inline
danielealbano Aug 11, 2022
7e04b3e
Add tests for the hashtable single producer single consumer
danielealbano Aug 11, 2022
d395282
Fix headers
danielealbano Aug 11, 2022
9c7d9ce
Add a flag to enable strict parsing of the redis commands
danielealbano Aug 11, 2022
ddb3074
Update the configuration documentation after the massive reorganisati…
danielealbano Aug 11, 2022
1d87974
Benchmarks should be compiled with -O3
danielealbano Aug 11, 2022
81a6bb1
Finish the initial cut implementation of the redis commands parser
danielealbano Aug 11, 2022
406d186
No reason to generate "values" for bool arguments because they are al…
danielealbano Aug 11, 2022
64b6c3c
Fix message
danielealbano Aug 11, 2022
4104553
Move the hashtable mpmc tests under the data_structures folder
danielealbano Aug 12, 2022
050b1bf
Add a required include to the c files generated by the scaffolding ge…
danielealbano Aug 12, 2022
a43ebf8
Move some general structs from protocol redis reader to protocol redis
danielealbano Aug 12, 2022
7dc362d
Add stddef to some additional files
danielealbano Aug 12, 2022
c432aba
Refactor the hashtable spsc to make it more testable, also add hashta…
danielealbano Aug 12, 2022
cb1f956
Add a new component to pre-generation at the start of some data for t…
danielealbano Aug 12, 2022
2ed41c9
Fix headers order
danielealbano Aug 12, 2022
b1251f0
Remove the token found from token entry and get the live value from t…
danielealbano Aug 12, 2022
c873199
General performances improvements
danielealbano Aug 12, 2022
4a6f7a8
Search the command using the pre-generated hashtable for the commands…
danielealbano Aug 12, 2022
2baf697
Fix commented out test to fix tests build
danielealbano Aug 12, 2022
42b6579
Merge branch 'main' into 153-implement-a-code-generator-to-to-automat…
danielealbano Aug 12, 2022
2d6043b
Various fix ups after merging main onto the branch
danielealbano Aug 12, 2022
9645363
If the command parser returns false the connection needs to be aborte…
danielealbano Aug 14, 2022
a0d0364
If there is a parsing error a message can be sent back
danielealbano Aug 14, 2022
90cbd85
Fix various error messages
danielealbano Aug 14, 2022
5bb1b08
If an error message is set, no failure should be reported as if it's …
danielealbano Aug 14, 2022
b062d91
To make the code more readable, avoid that the nested command argumen…
danielealbano Aug 14, 2022
e5b427a
One more error message cleanup
danielealbano Aug 14, 2022
402f9ff
Style fixes
danielealbano Aug 14, 2022
8edd4a6
In argument end, if a ONEOF argument type is supposed to be expected …
danielealbano Aug 14, 2022
7a9fab6
Fix tests for unfinished testing unit
danielealbano Aug 14, 2022
5398d36
Fix tests to work with the new automated parser (different error mess…
danielealbano Aug 14, 2022
9a72133
Fix LGTM alerts and ensure that the module_redis_connection_error_mes…
danielealbano Aug 14, 2022
745bdaa
Fix fixtures used in config related tests
danielealbano Aug 14, 2022
cc96f4b
Add an extra test to ensure that etc/cachegrand.yaml.skel is always v…
danielealbano Aug 14, 2022
72f548d
Style fix
danielealbano Aug 14, 2022
c5417ae
Build the path to the skel config file dinamically
danielealbano Aug 14, 2022
8110106
Ensure ping command is able to send out long replies
danielealbano Aug 15, 2022
e73c983
Handle correctly 0 length arguments
danielealbano Aug 15, 2022
117eed5
Update not implemented test
danielealbano Aug 15, 2022
d1b039f
Fix test for RESP command with one argument with 0 length
danielealbano Aug 15, 2022
7c82e64
Add a test to validate the key length when it's non positional (e.g. …
danielealbano Aug 15, 2022
5521368
Add codecov.yml to disable codecov/status
danielealbano Aug 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benches/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ foreach(SRC_CACHEGRAND_BENCH ${SRC_CACHEGRAND_BENCHES})
target_compile_options(
${CACHEGRAND_BENCH_EXEC_NAME}
PRIVATE
-mclflushopt -march=native)
-mclflushopt -march=native -O3)

set_target_properties(
${CACHEGRAND_BENCH_EXEC_NAME}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "data_structures/hashtable/mcmp/hashtable_op_get.h"

#include "../tests/support.h"
#include "../tests/hashtable/fixtures-hashtable.h"
#include "hashtable/mpmc/fixtures-hashtable-mpmc.h"

#include "benchmark-program.hpp"
#include "benchmark-support.hpp"
Expand Down Expand Up @@ -120,12 +120,14 @@ static void hashtable_op_get_single_key_external(benchmark::State& state) {
bucket_index = test_key_1_hash % hashtable->ht_current->buckets_count;
chunk_index = HASHTABLE_TO_CHUNK_INDEX(bucket_index);
chunk_slot_index = 0;
char *test_key_1_clone = (char*)slab_allocator_mem_alloc_zero(test_key_1_len + 1);
strncpy(test_key_1_clone, test_key_1, test_key_1_len);

HASHTABLE_SET_KEY_EXTERNAL_BY_INDEX(
chunk_index,
chunk_slot_index,
test_key_1_hash,
test_key_1,
test_key_1_clone,
test_key_1_len,
test_value_1);
}
Expand Down Expand Up @@ -160,11 +162,7 @@ static void hashtable_op_get_single_key_external(benchmark::State& state) {

static void BenchArguments(benchmark::internal::Benchmark* b) {
b
->ArgsProduct({
{ 0x0000FFFFu, 0x000FFFFFu, 0x001FFFFFu, 0x007FFFFFu, 0x00FFFFFFu, 0x01FFFFFFu, 0x07FFFFFFu,
0x0FFFFFFFu, 0x1FFFFFFFu, 0x3FFFFFFFu, 0x7FFFFFFFu },
{ 50, 75 },
})
->Arg(256)
->ThreadRange(TEST_THREADS_RANGE_BEGIN, TEST_THREADS_RANGE_END)
->Iterations(10000000)
->DisplayAggregatesOnly(false);
Expand Down
146 changes: 146 additions & 0 deletions benches/bench-hashtable-spsc-op-get.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
/**
* Copyright (C) 2018-2022 Daniele Salvatore Albano
* All rights reserved.
*
* This software may be modified and distributed under the terms
* of the BSD license. See the LICENSE file for details.
**/

#include <cstring>
#include <benchmark/benchmark.h>

#include "benchmark-program.hpp"

#include "data_structures/hashtable/spsc/hashtable_spsc.h"

#pragma GCC diagnostic ignored "-Wwrite-strings"
#pragma GCC diagnostic ignored "-Wpointer-arith"

char *global_keys[] = {
"SET", "ACL", "ACL CAT", "ACL DELUSER", "ACL DRYRUN", "ACL GENPASS", "ACL GETUSER", "ACL HELP", "ACL LIST", "ACL LOAD",
"ACL LOG", "ACL SAVE", "ACL SETUSER", "ACL USERS", "ACL WHOAMI", "APPEND", "ASKING", "AUTH", "BGREWRITEAOF",
"BGSAVE", "BITCOUNT", "BITFIELD", "BITFIELD_RO", "BITOP", "BITPOS", "BLMOVE", "BLMPOP", "BLPOP", "BRPOP",
"BRPOPLPUSH", "BZMPOP", "BZPOPMAX", "BZPOPMIN", "CLIENT", "CLIENT CACHING", "CLIENT GETNAME", "CLIENT GETREDIR",
"CLIENT HELP", "CLIENT ID", "CLIENT INFO", "CLIENT KILL", "CLIENT LIST", "CLIENT NO-EVICT", "CLIENT PAUSE",
"CLIENT REPLY", "CLIENT SETNAME", "CLIENT TRACKING", "CLIENT TRACKINGINFO", "CLIENT UNBLOCK", "CLIENT UNPAUSE",
"CLUSTER", "CLUSTER ADDSLOTS", "CLUSTER ADDSLOTSRANGE", "CLUSTER BUMPEPOCH", "CLUSTER COUNT-FAILURE-REPORTS",
"CLUSTER COUNTKEYSINSLOT", "CLUSTER DELSLOTS", "CLUSTER DELSLOTSRANGE", "CLUSTER FAILOVER", "CLUSTER FLUSHSLOTS",
"CLUSTER FORGET", "CLUSTER GETKEYSINSLOT", "CLUSTER HELP", "CLUSTER INFO", "CLUSTER KEYSLOT", "CLUSTER LINKS",
"CLUSTER MEET", "CLUSTER MYID", "CLUSTER NODES", "CLUSTER REPLICAS", "CLUSTER REPLICATE", "CLUSTER RESET",
"CLUSTER SAVECONFIG", "CLUSTER SET-CONFIG-EPOCH", "CLUSTER SETSLOT", "CLUSTER SHARDS", "CLUSTER SLAVES",
"CLUSTER SLOTS", "COMMAND", "COMMAND COUNT", "COMMAND DOCS", "COMMAND GETKEYS", "COMMAND GETKEYSANDFLAGS",
"COMMAND HELP", "COMMAND INFO", "COMMAND LIST", "CONFIG", "CONFIG GET", "CONFIG HELP", "CONFIG RESETSTAT",
"CONFIG REWRITE", "CONFIG SET", "COPY", "DBSIZE", "DEBUG", "DECR", "DECRBY", "DEL", "DISCARD", "DUMP", "ECHO",
"EVAL", "EVALSHA", "EVALSHA_RO", "EVAL_RO", "EXEC", "EXISTS", "EXPIRE", "EXPIREAT", "EXPIRETIME", "FAILOVER",
"FCALL", "FCALL_RO", "FLUSHALL", "FLUSHDB", "FUNCTION", "FUNCTION DELETE", "FUNCTION DUMP", "FUNCTION FLUSH",
"FUNCTION HELP", "FUNCTION KILL", "FUNCTION LIST", "FUNCTION LOAD", "FUNCTION RESTORE", "FUNCTION STATS", "GEOADD",
"GEODIST", "GEOHASH", "GEOPOS", "GEORADIUS", "GEORADIUSBYMEMBER", "GEORADIUSBYMEMBER_RO", "GEORADIUS_RO",
"GEOSEARCH", "GEOSEARCHSTORE", "GET", "GETBIT", "GETDEL", "GETEX", "GETRANGE", "GETSET", "HDEL", "HELLO",
"HEXISTS", "HGET", "HGETALL", "HINCRBY", "HINCRBYFLOAT", "HKEYS", "HLEN", "HMGET", "HMSET", "HRANDFIELD",
"HSCAN", "HSET", "HSETNX", "HSTRLEN", "HVALS", "INCR", "INCRBY", "INCRBYFLOAT", "INFO", "KEYS", "LASTSAVE",
"LATENCY", "LATENCY DOCTOR", "LATENCY GRAPH", "LATENCY HELP", "LATENCY HISTOGRAM", "LATENCY HISTORY",
"LATENCY LATEST", "LATENCY RESET", "LCS", "LINDEX", "LINSERT", "LLEN", "LMOVE", "LMPOP", "LOLWUT", "LPOP",
"LPOS", "LPUSH", "LPUSHX", "LRANGE", "LREM", "LSET", "LTRIM", "MEMORY", "MEMORY DOCTOR", "MEMORY HELP",
"MEMORY MALLOC-STATS", "MEMORY PURGE", "MEMORY STATS", "MEMORY USAGE", "MGET", "MIGRATE", "MODULE", "MODULE HELP",
"MODULE LIST", "MODULE LOAD", "MODULE LOADEX", "MODULE UNLOAD", "MONITOR", "MOVE", "MSET", "MSETNX", "MULTI",
"OBJECT", "OBJECT ENCODING", "OBJECT FREQ", "OBJECT HELP", "OBJECT IDLETIME", "OBJECT REFCOUNT", "PERSIST",
"PEXPIRE", "PEXPIREAT", "PEXPIRETIME", "PFADD", "PFCOUNT", "PFDEBUG", "PFMERGE", "PFSELFTEST", "PING", "PSETEX",
"PSUBSCRIBE", "PSYNC", "PTTL", "PUBLISH", "PUBSUB", "PUBSUB CHANNELS", "PUBSUB HELP", "PUBSUB NUMPAT", "PUBSUB NUMSUB",
"PUBSUB SHARDCHANNELS", "PUBSUB SHARDNUMSUB", "PUNSUBSCRIBE", "QUIT", "RANDOMKEY", "READONLY", "READWRITE", "RENAME",
"RENAMENX", "REPLCONF", "REPLICAOF", "RESET", "RESTORE", "RESTORE-ASKING", "ROLE", "RPOP", "RPOPLPUSH", "RPUSH",
"RPUSHX", "SADD", "SAVE", "SCAN", "SCARD", "SCRIPT", "SCRIPT DEBUG", "SCRIPT EXISTS", "SCRIPT FLUSH", "SCRIPT HELP",
"SCRIPT KILL", "SCRIPT LOAD", "SDIFF", "SDIFFSTORE", "SELECT", "SETBIT", "SETEX", "SETNX", "SETRANGE", "SHUTDOWN",
"SINTER", "SINTERCARD", "SINTERSTORE", "SISMEMBER", "SLAVEOF", "SLOWLOG", "SLOWLOG GET", "SLOWLOG HELP", "SLOWLOG LEN",
"SLOWLOG RESET", "SMEMBERS", "SMISMEMBER", "SMOVE", "SORT", "SORT_RO", "SPOP", "SPUBLISH", "SRANDMEMBER", "SREM",
"SSCAN", "SSUBSCRIBE", "STRLEN", "SUBSCRIBE", "SUBSTR", "SUNION", "SUNIONSTORE", "SUNSUBSCRIBE", "SWAPDB", "SYNC",
"TIME", "TOUCH", "TTL", "TYPE", "UNLINK", "UNSUBSCRIBE", "UNWATCH", "WAIT", "WATCH", "XACK", "XADD", "XAUTOCLAIM",
"XCLAIM", "XDEL", "XGROUP", "XGROUP CREATE", "XGROUP CREATECONSUMER", "XGROUP DELCONSUMER", "XGROUP DESTROY",
"XGROUP HELP", "XGROUP SETID", "XINFO", "XINFO CONSUMERS", "XINFO GROUPS", "XINFO HELP", "XINFO STREAM", "XLEN",
"XPENDING", "XRANGE", "XREAD", "XREADGROUP", "XREVRANGE", "XSETID", "XTRIM", "ZADD", "ZCARD", "ZCOUNT", "ZDIFF",
"ZDIFFSTORE", "ZINCRBY", "ZINTER", "ZINTERCARD", "ZINTERSTORE", "ZLEXCOUNT", "ZMPOP", "ZMSCORE", "ZPOPMAX", "ZPOPMIN",
"ZRANDMEMBER", "ZRANGE", "ZRANGEBYLEX", "ZRANGEBYSCORE", "ZRANGESTORE", "ZRANK", "ZREM", "ZREMRANGEBYLEX",
"ZREMRANGEBYRANK", "ZREMRANGEBYSCORE", "ZREVRANGE", "ZREVRANGEBYLEX", "ZREVRANGEBYSCORE", "ZREVRANK", "ZSCAN",
"ZSCORE", "ZUNION", "ZUNIONSTORE",
};
int global_keys_count = ARRAY_SIZE(global_keys);


class HashtableSpscOpGetFixture : public benchmark::Fixture {
private:
hashtable_spsc_t *_hashtable = nullptr;
char **_keys = (char**)global_keys;
int _keys_count = global_keys_count;
public:
hashtable_spsc_t *GetHashtable() {
return this->_hashtable;
}

void SetUp(benchmark::State& state) override {
this->_hashtable = hashtable_spsc_new(
HASHTABLE_SPSC_DEFAULT_MAX_RANGE,
false,
this->_keys_count);

for (int index = 0; index < this->_keys_count; index++) {
if (!hashtable_spsc_op_set(this->_hashtable, _keys[index], strlen(_keys[index]), _keys[index])) {
char message[250] = { 0 };
snprintf(message, sizeof(message) - 1, "Unable to insert the token '%s'", _keys[index]);
state.SkipWithError(message);
return;
}
}
}

void TearDown(const ::benchmark::State &state) override {
hashtable_spsc_free(this->_hashtable);
}
};

BENCHMARK_DEFINE_F(HashtableSpscOpGetFixture, FindTokenInHashtableWorstCase1Benchmark)(benchmark::State& state) {
for (auto _ : state) {
benchmark::DoNotOptimize(hashtable_spsc_op_get(
this->GetHashtable(),
"non-existing",
strlen("non-existing")));
}
}

BENCHMARK_DEFINE_F(HashtableSpscOpGetFixture, FindTokenInHashtableWorstCase2Benchmark)(benchmark::State& state) {
for (auto _ : state) {
benchmark::DoNotOptimize(hashtable_spsc_op_get(
this->GetHashtable(),
"non-existing",
strlen("non-existing")));
}
}

BENCHMARK_DEFINE_F(HashtableSpscOpGetFixture, FindTokenInHashtableAvgCase1Benchmark)(benchmark::State& state) {
for (auto _ : state) {
benchmark::DoNotOptimize(hashtable_spsc_op_get(
this->GetHashtable(),
"set",
strlen("set")));
}
}

BENCHMARK_DEFINE_F(HashtableSpscOpGetFixture, FindTokenInHashtableAvgCase2Benchmark)(benchmark::State& state) {
for (auto _ : state) {
benchmark::DoNotOptimize(hashtable_spsc_op_get(
this->GetHashtable(),
"append",
strlen("append")));
}
}

static void BenchArguments(benchmark::internal::Benchmark* b) {
b->Iterations(100000)->UseRealTime();
}

BENCHMARK_REGISTER_F(HashtableSpscOpGetFixture, FindTokenInHashtableWorstCase1Benchmark)
->Apply(BenchArguments);
BENCHMARK_REGISTER_F(HashtableSpscOpGetFixture, FindTokenInHashtableWorstCase2Benchmark)
->Apply(BenchArguments);
BENCHMARK_REGISTER_F(HashtableSpscOpGetFixture, FindTokenInHashtableAvgCase1Benchmark)
->Apply(BenchArguments);
BENCHMARK_REGISTER_F(HashtableSpscOpGetFixture, FindTokenInHashtableAvgCase2Benchmark)
->Apply(BenchArguments);
9 changes: 9 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
coverage:
precision: 2
round: nearest
range: "70...100"
status:
project:
default:
threshold: 3%
patch: off
Loading