@@ -68,6 +68,9 @@ int main(int argc, char* argv[])
68
68
const command_line::arg_descriptor<bool > arg_outputs = {" with-outputs" , " with output stats" , false };
69
69
const command_line::arg_descriptor<bool > arg_ringsize = {" with-ringsize" , " with ringsize stats" , false };
70
70
const command_line::arg_descriptor<bool > arg_hours = {" with-hours" , " with txns per hour" , false };
71
+ const command_line::arg_descriptor<bool > arg_emission = {" with-emission" , " with coin emission" , false };
72
+ const command_line::arg_descriptor<bool > arg_fees = {" with-fees" , " with txn fees" , false };
73
+ const command_line::arg_descriptor<bool > arg_diff = {" with-diff" , " with difficulty" , false };
71
74
72
75
command_line::add_arg (desc_cmd_sett, cryptonote::arg_data_dir);
73
76
command_line::add_arg (desc_cmd_sett, cryptonote::arg_testnet_on);
@@ -79,6 +82,9 @@ int main(int argc, char* argv[])
79
82
command_line::add_arg (desc_cmd_sett, arg_outputs);
80
83
command_line::add_arg (desc_cmd_sett, arg_ringsize);
81
84
command_line::add_arg (desc_cmd_sett, arg_hours);
85
+ command_line::add_arg (desc_cmd_sett, arg_emission);
86
+ command_line::add_arg (desc_cmd_sett, arg_fees);
87
+ command_line::add_arg (desc_cmd_sett, arg_diff);
82
88
command_line::add_arg (desc_cmd_only, command_line::arg_help);
83
89
84
90
po::options_description desc_options (" Allowed options" );
@@ -120,6 +126,9 @@ int main(int argc, char* argv[])
120
126
bool do_outputs = command_line::get_arg (vm, arg_outputs);
121
127
bool do_ringsize = command_line::get_arg (vm, arg_ringsize);
122
128
bool do_hours = command_line::get_arg (vm, arg_hours);
129
+ bool do_emission = command_line::get_arg (vm, arg_emission);
130
+ bool do_fees = command_line::get_arg (vm, arg_fees);
131
+ bool do_diff = command_line::get_arg (vm, arg_diff);
123
132
124
133
LOG_PRINT_L0 (" Initializing source blockchain (BlockchainDB)" );
125
134
std::unique_ptr<Blockchain> core_storage;
@@ -177,12 +186,20 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, ''
177
186
// spit out a comment that GnuPlot can use as an index
178
187
std::cout << ENDL << " # DATA" << ENDL;
179
188
std::cout << " Date\t Blocks/day\t Blocks\t Txs/Day\t Txs\t Bytes/Day\t Bytes" ;
189
+ if (do_emission)
190
+ std::cout << " \t Emission/day\t Emission" ;
191
+ if (do_fees)
192
+ std::cout << " \t Fees/day\t Fees" ;
193
+ if (do_diff)
194
+ std::cout << " \t DiffMin\t DiffMax\t DiffAvg" ;
180
195
if (do_inputs)
181
196
std::cout << " \t InMin\t InMax\t InAvg" ;
182
197
if (do_outputs)
183
198
std::cout << " \t OutMin\t OutMax\t OutAvg" ;
184
199
if (do_ringsize)
185
200
std::cout << " \t RingMin\t RingMax\t RingAvg" ;
201
+ if (do_inputs || do_outputs || do_ringsize)
202
+ std::cout << std::setprecision (2 ) << std::fixed;
186
203
if (do_hours) {
187
204
char buf[8 ];
188
205
unsigned int i;
@@ -193,14 +210,20 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, ''
193
210
}
194
211
std::cout << ENDL;
195
212
213
+ #define MAX_INOUT 0xffffffff
214
+ #define MAX_RINGS 0xffffffff
215
+
196
216
struct tm prevtm = {0 }, currtm;
197
217
uint64_t prevsz = 0 , currsz = 0 ;
198
218
uint64_t prevtxs = 0 , currtxs = 0 ;
199
219
uint64_t currblks = 0 ;
200
220
uint64_t totins = 0 , totouts = 0 , totrings = 0 ;
201
- uint32_t minins = 10 , maxins = 0 ;
202
- uint32_t minouts = 10 , maxouts = 0 ;
203
- uint32_t minrings = 50 , maxrings = 0 ;
221
+ boost::multiprecision::uint128_t prevemission = 0 , prevfees = 0 ;
222
+ boost::multiprecision::uint128_t emission = 0 , fees = 0 ;
223
+ boost::multiprecision::uint128_t totdiff = 0 , mindiff = 0 , maxdiff = 0 ;
224
+ uint32_t minins = MAX_INOUT, maxins = 0 ;
225
+ uint32_t minouts = MAX_INOUT, maxouts = 0 ;
226
+ uint32_t minrings = MAX_RINGS, maxrings = 0 ;
204
227
uint32_t io, tottxs = 0 ;
205
228
uint32_t txhr[24 ] = {0 };
206
229
unsigned int i;
@@ -230,34 +253,50 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, ''
230
253
std::cout << timebuf << " \t " << currblks << " \t " << h << " \t " << currtxs << " \t " << prevtxs + currtxs << " \t " << currsz << " \t " << prevsz + currsz;
231
254
prevsz += currsz;
232
255
currsz = 0 ;
233
- currblks = 0 ;
234
256
prevtxs += currtxs;
235
257
currtxs = 0 ;
236
258
if (!tottxs)
237
259
tottxs = 1 ;
260
+ if (do_emission) {
261
+ std::cout << " \t " << print_money (emission) << " \t " << print_money (prevemission + emission);
262
+ prevemission += emission;
263
+ emission = 0 ;
264
+ }
265
+ if (do_fees) {
266
+ std::cout << " \t " << print_money (fees) << " \t " << print_money (prevfees + fees);
267
+ prevfees += fees;
268
+ fees = 0 ;
269
+ }
270
+ if (do_diff) {
271
+ std::cout << " \t " << (maxdiff ? mindiff : 0 ) << " \t " << maxdiff << " \t " << totdiff / currblks;
272
+ mindiff = 0 ; maxdiff = 0 ; totdiff = 0 ;
273
+ }
238
274
if (do_inputs) {
239
- std::cout << " \t " << (maxins ? minins : 0 ) << " \t " << maxins << " \t " << totins / tottxs;
240
- minins = 10 ; maxins = 0 ; totins = 0 ;
275
+ std::cout << " \t " << (maxins ? minins : 0 ) << " \t " << maxins << " \t " << totins * 1.0 / tottxs;
276
+ minins = MAX_INOUT ; maxins = 0 ; totins = 0 ;
241
277
}
242
278
if (do_outputs) {
243
- std::cout << " \t " << (maxouts ? minouts : 0 ) << " \t " << maxouts << " \t " << totouts / tottxs;
244
- minouts = 10 ; maxouts = 0 ; totouts = 0 ;
279
+ std::cout << " \t " << (maxouts ? minouts : 0 ) << " \t " << maxouts << " \t " << totouts * 1.0 / tottxs;
280
+ minouts = MAX_INOUT ; maxouts = 0 ; totouts = 0 ;
245
281
}
246
282
if (do_ringsize) {
247
- std::cout << " \t " << (maxrings ? minrings : 0 ) << " \t " << maxrings << " \t " << totrings / tottxs;
248
- minrings = 50 ; maxrings = 0 ; totrings = 0 ;
283
+ std::cout << " \t " << (maxrings ? minrings : 0 ) << " \t " << maxrings << " \t " << totrings * 1.0 / tottxs;
284
+ minrings = MAX_RINGS ; maxrings = 0 ; totrings = 0 ;
249
285
}
250
- tottxs = 0 ;
251
286
if (do_hours) {
252
287
for (i=0 ; i<24 ; i++) {
253
288
std::cout << " \t " << txhr[i];
254
289
txhr[i] = 0 ;
255
290
}
256
291
}
292
+ currblks = 0 ;
293
+ tottxs = 0 ;
257
294
std::cout << ENDL;
258
295
}
259
296
skip:
260
297
currsz += bd.size ();
298
+ uint64_t coinbase_amount;
299
+ uint64_t tx_fee_amount = 0 ;
261
300
for (const auto & tx_id : blk.tx_hashes )
262
301
{
263
302
if (tx_id == crypto::null_hash)
@@ -275,7 +314,12 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, ''
275
314
return 1 ;
276
315
}
277
316
currsz += bd.size ();
317
+ if (db->get_prunable_tx_blob (tx_id, bd))
318
+ currsz += bd.size ();
278
319
currtxs++;
320
+ if (do_fees || do_emission) {
321
+ tx_fee_amount += get_tx_fee (tx);
322
+ }
279
323
if (do_hours)
280
324
txhr[currtm.tm_hour ]++;
281
325
if (do_inputs) {
@@ -306,6 +350,21 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, ''
306
350
}
307
351
tottxs++;
308
352
}
353
+ if (do_diff) {
354
+ difficulty_type diff = db->get_block_difficulty (h);
355
+ if (!mindiff || diff < mindiff)
356
+ mindiff = diff;
357
+ if (diff > maxdiff)
358
+ maxdiff = diff;
359
+ totdiff += diff;
360
+ }
361
+ if (do_emission) {
362
+ coinbase_amount = get_outs_money_amount (blk.miner_tx );
363
+ emission += coinbase_amount - tx_fee_amount;
364
+ }
365
+ if (do_fees) {
366
+ fees += tx_fee_amount;
367
+ }
309
368
currblks++;
310
369
311
370
if (stop_requested)
0 commit comments