Electroneum
Loading...
Searching...
No Matches
main.cpp File Reference
#include <boost/regex.hpp>
#include "common/util.h"
#include "common/command_line.h"
#include "performance_tests.h"
#include "performance_utils.h"
#include "construct_tx.h"
#include "check_tx_signature.h"
#include "check_hash.h"
#include "cn_slow_hash.h"
#include "derive_public_key.h"
#include "derive_secret_key.h"
#include "ge_frombytes_vartime.h"
#include "ge_tobytes.h"
#include "generate_key_derivation.h"
#include "generate_key_image.h"
#include "generate_key_image_helper.h"
#include "generate_keypair.h"
#include "signature.h"
#include "is_out_to_acc.h"
#include "subaddress_expand.h"
#include "sc_reduce32.h"
#include "sc_check.h"
#include "cn_fast_hash.h"
#include "rct_mlsag.h"
#include "equality.h"
#include "range_proof.h"
#include "bulletproof.h"
#include "crypto_ops.h"
#include "multiexp.h"
Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 67 of file main.cpp.

68{
69 TRY_ENTRY();
73
74 mlog_configure(mlog_get_default_log_path("performance_tests.log"), true);
75
76 po::options_description desc_options("Command line options");
77 const command_line::arg_descriptor<std::string> arg_filter = { "filter", "Regular expression filter for which tests to run" };
78 const command_line::arg_descriptor<bool> arg_verbose = { "verbose", "Verbose output", false };
79 const command_line::arg_descriptor<bool> arg_stats = { "stats", "Including statistics (min/median)", false };
80 const command_line::arg_descriptor<unsigned> arg_loop_multiplier = { "loop-multiplier", "Run for that many times more loops", 1 };
81 const command_line::arg_descriptor<std::string> arg_timings_database = { "timings-database", "Keep timings history in a file" };
82 command_line::add_arg(desc_options, arg_filter);
83 command_line::add_arg(desc_options, arg_verbose);
84 command_line::add_arg(desc_options, arg_stats);
85 command_line::add_arg(desc_options, arg_loop_multiplier);
86 command_line::add_arg(desc_options, arg_timings_database);
87
88 po::variables_map vm;
89 bool r = command_line::handle_error_helper(desc_options, [&]()
90 {
91 po::store(po::parse_command_line(argc, argv, desc_options), vm);
92 po::notify(vm);
93 return true;
94 });
95 if (!r)
96 return 1;
97
98 const std::string filter = tools::glob_to_regex(command_line::get_arg(vm, arg_filter));
99 const std::string timings_database = command_line::get_arg(vm, arg_timings_database);
100 Params p;
101 if (!timings_database.empty())
102 p.td = TimingsDatabase(timings_database);
103 p.verbose = command_line::get_arg(vm, arg_verbose);
104 p.stats = command_line::get_arg(vm, arg_stats);
105 p.loop_multiplier = command_line::get_arg(vm, arg_loop_multiplier);
106
107 performance_timer timer;
108 timer.start();
109
110 TEST_PERFORMANCE3(filter, p, test_construct_tx, 1, 1, false);
111 TEST_PERFORMANCE3(filter, p, test_construct_tx, 1, 2, false);
112 TEST_PERFORMANCE3(filter, p, test_construct_tx, 1, 10, false);
113 TEST_PERFORMANCE3(filter, p, test_construct_tx, 1, 100, false);
114 TEST_PERFORMANCE3(filter, p, test_construct_tx, 1, 1000, false);
115
116 TEST_PERFORMANCE3(filter, p, test_construct_tx, 2, 1, false);
117 TEST_PERFORMANCE3(filter, p, test_construct_tx, 2, 2, false);
118 TEST_PERFORMANCE3(filter, p, test_construct_tx, 2, 10, false);
119 TEST_PERFORMANCE3(filter, p, test_construct_tx, 2, 100, false);
120
121 TEST_PERFORMANCE3(filter, p, test_construct_tx, 10, 1, false);
122 TEST_PERFORMANCE3(filter, p, test_construct_tx, 10, 2, false);
123 TEST_PERFORMANCE3(filter, p, test_construct_tx, 10, 10, false);
124 TEST_PERFORMANCE3(filter, p, test_construct_tx, 10, 100, false);
125
126 TEST_PERFORMANCE3(filter, p, test_construct_tx, 100, 1, false);
127 TEST_PERFORMANCE3(filter, p, test_construct_tx, 100, 2, false);
128 TEST_PERFORMANCE3(filter, p, test_construct_tx, 100, 10, false);
129 TEST_PERFORMANCE3(filter, p, test_construct_tx, 100, 100, false);
130
131 TEST_PERFORMANCE3(filter, p, test_construct_tx, 2, 1, true);
132 TEST_PERFORMANCE3(filter, p, test_construct_tx, 2, 2, true);
133 TEST_PERFORMANCE3(filter, p, test_construct_tx, 2, 10, true);
134
135 TEST_PERFORMANCE3(filter, p, test_construct_tx, 10, 1, true);
136 TEST_PERFORMANCE3(filter, p, test_construct_tx, 10, 2, true);
137 TEST_PERFORMANCE3(filter, p, test_construct_tx, 10, 10, true);
138
139 TEST_PERFORMANCE3(filter, p, test_construct_tx, 100, 1, true);
140 TEST_PERFORMANCE3(filter, p, test_construct_tx, 100, 2, true);
141 TEST_PERFORMANCE3(filter, p, test_construct_tx, 100, 10, true);
142
146
150
154
155 TEST_PERFORMANCE3(filter, p, test_check_tx_signature, 1, 2, false);
156 TEST_PERFORMANCE3(filter, p, test_check_tx_signature, 2, 2, false);
157 TEST_PERFORMANCE3(filter, p, test_check_tx_signature, 10, 2, false);
158 TEST_PERFORMANCE3(filter, p, test_check_tx_signature, 100, 2, false);
159 TEST_PERFORMANCE3(filter, p, test_check_tx_signature, 2, 10, false);
160
165
174
179
184
185 TEST_PERFORMANCE4(filter, p, test_check_hash, 0, 1, 0, 1);
186 TEST_PERFORMANCE4(filter, p, test_check_hash, 0, 0xffffffffffffffff, 0, 0xffffffffffffffff);
187 TEST_PERFORMANCE4(filter, p, test_check_hash, 0, 0xffffffffffffffff, 0, 1);
188 TEST_PERFORMANCE4(filter, p, test_check_hash, 1, 0, 1, 0);
189 TEST_PERFORMANCE4(filter, p, test_check_hash, 1, 0, 0, 1);
190 TEST_PERFORMANCE4(filter, p, test_check_hash, 0xffffffffffffffff, 0xffffffffffffffff, 0, 1);
191 TEST_PERFORMANCE4(filter, p, test_check_hash, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff);
192
205 TEST_PERFORMANCE1(filter, p, test_signature, false);
206 TEST_PERFORMANCE1(filter, p, test_signature, true);
207
209
214 TEST_PERFORMANCE1(filter, p, test_cn_fast_hash, 32);
215 TEST_PERFORMANCE1(filter, p, test_cn_fast_hash, 16384);
216
217 TEST_PERFORMANCE3(filter, p, test_ringct_mlsag, 1, 3, false);
218 TEST_PERFORMANCE3(filter, p, test_ringct_mlsag, 1, 5, false);
219 TEST_PERFORMANCE3(filter, p, test_ringct_mlsag, 1, 10, false);
220 TEST_PERFORMANCE3(filter, p, test_ringct_mlsag, 1, 100, false);
221 TEST_PERFORMANCE3(filter, p, test_ringct_mlsag, 1, 3, true);
222 TEST_PERFORMANCE3(filter, p, test_ringct_mlsag, 1, 5, true);
223 TEST_PERFORMANCE3(filter, p, test_ringct_mlsag, 1, 10, true);
224 TEST_PERFORMANCE3(filter, p, test_ringct_mlsag, 1, 100, true);
225
226 TEST_PERFORMANCE2(filter, p, test_equality, memcmp32, true);
227 TEST_PERFORMANCE2(filter, p, test_equality, memcmp32, false);
228 TEST_PERFORMANCE2(filter, p, test_equality, verify32, false);
229 TEST_PERFORMANCE2(filter, p, test_equality, verify32, false);
230
231 TEST_PERFORMANCE1(filter, p, test_range_proof, true);
232 TEST_PERFORMANCE1(filter, p, test_range_proof, false);
233
234 TEST_PERFORMANCE2(filter, p, test_bulletproof, true, 1); // 1 bulletproof with 1 amount
235 TEST_PERFORMANCE2(filter, p, test_bulletproof, false, 1);
236
237 TEST_PERFORMANCE2(filter, p, test_bulletproof, true, 2); // 1 bulletproof with 2 amounts
238 TEST_PERFORMANCE2(filter, p, test_bulletproof, false, 2);
239
240 TEST_PERFORMANCE2(filter, p, test_bulletproof, true, 15); // 1 bulletproof with 15 amounts
241 TEST_PERFORMANCE2(filter, p, test_bulletproof, false, 15);
242
243 TEST_PERFORMANCE6(filter, p, test_aggregated_bulletproof, false, 2, 1, 1, 0, 4);
244 TEST_PERFORMANCE6(filter, p, test_aggregated_bulletproof, true, 2, 1, 1, 0, 4); // 4 proofs, each with 2 amounts
245 TEST_PERFORMANCE6(filter, p, test_aggregated_bulletproof, false, 8, 1, 1, 0, 4);
246 TEST_PERFORMANCE6(filter, p, test_aggregated_bulletproof, true, 8, 1, 1, 0, 4); // 4 proofs, each with 8 amounts
247 TEST_PERFORMANCE6(filter, p, test_aggregated_bulletproof, false, 1, 1, 2, 0, 4);
248 TEST_PERFORMANCE6(filter, p, test_aggregated_bulletproof, true, 1, 1, 2, 0, 4); // 4 proofs with 1, 2, 4, 8 amounts
249 TEST_PERFORMANCE6(filter, p, test_aggregated_bulletproof, false, 1, 8, 1, 1, 4);
250 TEST_PERFORMANCE6(filter, p, test_aggregated_bulletproof, true, 1, 8, 1, 1, 4); // 32 proofs, with 1, 2, 3, 4 amounts, 8 of each
251 TEST_PERFORMANCE6(filter, p, test_aggregated_bulletproof, false, 2, 1, 1, 0, 64);
252 TEST_PERFORMANCE6(filter, p, test_aggregated_bulletproof, true, 2, 1, 1, 0, 64); // 64 proof, each with 2 amounts
253
254 TEST_PERFORMANCE3(filter, p, test_ringct_mlsag, 1, 3, false);
255 TEST_PERFORMANCE3(filter, p, test_ringct_mlsag, 1, 5, false);
256 TEST_PERFORMANCE3(filter, p, test_ringct_mlsag, 1, 10, false);
257 TEST_PERFORMANCE3(filter, p, test_ringct_mlsag, 1, 100, false);
258 TEST_PERFORMANCE3(filter, p, test_ringct_mlsag, 1, 3, true);
259 TEST_PERFORMANCE3(filter, p, test_ringct_mlsag, 1, 5, true);
260 TEST_PERFORMANCE3(filter, p, test_ringct_mlsag, 1, 10, true);
261 TEST_PERFORMANCE3(filter, p, test_ringct_mlsag, 1, 100, true);
262
283
296
309
322
323#if 1
348#else
457
566#endif
567
568 std::cout << "Tests finished. Elapsed time: " << timer.elapsed_ms() / 1000 << " sec" << std::endl;
569
570 return 0;
571 CATCH_ENTRY_L0("main", 1);
572}
@ op_scalarmultKey
Definition crypto_ops.h:48
@ op_ge_double_scalarmult_base_vartime
Definition crypto_ops.h:52
@ op_ge_double_scalarmult_precomp_vartime
Definition crypto_ops.h:53
@ op_ge_add_raw
Definition crypto_ops.h:41
@ op_scalarmultH
Definition crypto_ops.h:49
@ op_zeroCommitUncached
Definition crypto_ops.h:59
@ op_sc_add
Definition crypto_ops.h:38
@ op_addKeys2
Definition crypto_ops.h:55
@ op_zeroCommitCached
Definition crypto_ops.h:43
@ op_ge_dsm_precomp
Definition crypto_ops.h:51
@ op_ge_double_scalarmult_precomp_vartime2
Definition crypto_ops.h:54
@ op_scalarmultBase
Definition crypto_ops.h:47
@ op_ge_add_p3_p3
Definition crypto_ops.h:42
@ op_addKeys
Definition crypto_ops.h:46
@ op_isInMainSubgroup
Definition crypto_ops.h:58
@ op_addKeys3_2
Definition crypto_ops.h:57
@ op_sc_sub
Definition crypto_ops.h:39
@ op_scalarmult8
Definition crypto_ops.h:50
@ op_addKeys3
Definition crypto_ops.h:56
@ op_sc_mul
Definition crypto_ops.h:40
void mlog_configure(const std::string &filename_base, bool console, const std::size_t max_log_file_size=MAX_LOG_FILE_SIZE, const std::size_t max_log_files=MAX_LOG_FILES)
Definition mlog.cpp:148
std::string mlog_get_default_log_path(const char *default_filename)
Definition mlog.cpp:72
#define CATCH_ENTRY_L0(lacation, return_val)
#define TRY_ENTRY()
void add_arg(boost::program_options::options_description &description, const arg_descriptor< T, required, dependent, NUM_DEPS > &arg, bool unique=true)
bool handle_error_helper(const boost::program_options::options_description &desc, F parser)
T get_arg(const boost::program_options::variables_map &vm, const arg_descriptor< T, false, true > &arg)
@ RangeProofBorromean
Definition rctTypes.h:235
@ RangeProofMultiOutputBulletproof
Definition rctTypes.h:235
@ RangeProofPaddedBulletproof
Definition rctTypes.h:235
std::string glob_to_regex(const std::string &val)
Definition util.cpp:1012
bool on_startup()
Definition util.cpp:778
#define TEST_PERFORMANCE4(filter, params, test_class, a0, a1, a2, a3)
#define TEST_PERFORMANCE0(filter, params, test_class)
#define TEST_PERFORMANCE6(filter, params, test_class, a0, a1, a2, a3, a4, a5)
#define TEST_PERFORMANCE3(filter, params, test_class, a0, a1, a2)
#define TEST_PERFORMANCE1(filter, params, test_class, a0)
#define TEST_PERFORMANCE2(filter, params, test_class, a0, a1)
#define TEST_PERFORMANCE5(filter, params, test_class, a0, a1, a2, a3, a4)
void set_thread_high_priority()
void set_process_affinity(int core)
unsigned loop_multiplier
TimingsDatabase td
@ multiexp_pippenger
Definition multiexp.h:42
@ multiexp_pippenger_cached
Definition multiexp.h:43
@ multiexp_straus_cached
Definition multiexp.h:41
@ multiexp_bos_coster
Definition multiexp.h:39
@ multiexp_straus
Definition multiexp.h:40
Here is the call graph for this function: