parse time data: added forgoten files
This commit is contained in:
parent
29efec2bd6
commit
95e2e8ec34
2 changed files with 53 additions and 0 deletions
44
tests/functional_tests/difficulty_analysis.cpp
Normal file
44
tests/functional_tests/difficulty_analysis.cpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright (c) 2014-2018 Zano Project
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/tokenizer.hpp>
|
||||
|
||||
#include "include_base_utils.h"
|
||||
using namespace epee;
|
||||
#include "wallet/wallet2.h"
|
||||
#include "currency_core/blockchain_storage.h"
|
||||
|
||||
|
||||
void run_difficulty_analysis(const std::string& path)
|
||||
{
|
||||
std::istringstream fstr(path);
|
||||
if (!fstr.good())
|
||||
{
|
||||
LOG_ERROR("unable to open " << path);
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_PRINT_L0("Loading array...");
|
||||
std::string line;
|
||||
std::vector<std::vector<uint64_t>> blocks;
|
||||
blocks.reserve(140000);
|
||||
while (std::getline(fstr, line))
|
||||
{
|
||||
std::vector<uint64_t> array_num;
|
||||
boost::tokenizer<> tok(line);
|
||||
std::transform(tok.begin(), tok.end(), std::back_inserter(array_num),
|
||||
&boost::lexical_cast<uint64_t, std::string>);
|
||||
|
||||
blocks.push_back(array_num);
|
||||
}
|
||||
LOG_PRINT_L0("Loaded " << blocks.size() << " lines");
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
9
tests/functional_tests/difficulty_analysis.h
Normal file
9
tests/functional_tests/difficulty_analysis.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) 2014-2018 Zano Project
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
|
||||
void run_difficulty_analysis(const std::string& path);
|
||||
|
||||
|
||||
Loading…
Add table
Reference in a new issue