aboutsummaryrefslogtreecommitdiffstats
path: root/vm.cpp
diff options
context:
space:
mode:
authorPaweł Bylica <pawel.bylica@imapp.pl>2015-03-16 19:01:47 +0800
committerPaweł Bylica <pawel.bylica@imapp.pl>2015-03-16 19:01:47 +0800
commit88ffd446f2243638e81f7d981fa9d616178bf036 (patch)
tree69f3bd723db29f854614d2685316ec373bbe1faf /vm.cpp
parent7469312e2156a29e07488e04886e7b27f449473f (diff)
parent45155d3c820a150d4222f7525fe5cc9bd3d55a5f (diff)
downloaddexon-solidity-88ffd446f2243638e81f7d981fa9d616178bf036.tar
dexon-solidity-88ffd446f2243638e81f7d981fa9d616178bf036.tar.gz
dexon-solidity-88ffd446f2243638e81f7d981fa9d616178bf036.tar.bz2
dexon-solidity-88ffd446f2243638e81f7d981fa9d616178bf036.tar.lz
dexon-solidity-88ffd446f2243638e81f7d981fa9d616178bf036.tar.xz
dexon-solidity-88ffd446f2243638e81f7d981fa9d616178bf036.tar.zst
dexon-solidity-88ffd446f2243638e81f7d981fa9d616178bf036.zip
Merge remote-tracking branch 'upstream/develop' into evmjit
Diffstat (limited to 'vm.cpp')
-rw-r--r--vm.cpp45
1 files changed, 12 insertions, 33 deletions
diff --git a/vm.cpp b/vm.cpp
index 4433a60e..2bdafb27 100644
--- a/vm.cpp
+++ b/vm.cpp
@@ -20,13 +20,12 @@
* vm test functions.
*/
-#include <chrono>
-
#include <boost/filesystem.hpp>
#include <libethereum/Executive.h>
#include <libevm/VMFactory.h>
#include "vm.h"
+#include "Stats.h"
using namespace std;
using namespace json_spirit;
@@ -312,11 +311,12 @@ namespace dev { namespace test {
void doVMTests(json_spirit::mValue& v, bool _fillin)
{
- Options::get(); // process command line options // TODO: We need to control the main() function
+ if (Options::get().stats)
+ Listener::registerListener(Stats::get());
for (auto& i: v.get_obj())
{
- cnote << i.first;
+ std::cout << " " << i.first << "\n";
mObject& o = i.second.get_obj();
BOOST_REQUIRE(o.count("env") > 0);
@@ -340,17 +340,21 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
bytes output;
u256 gas;
bool vmExceptionOccured = false;
- auto startTime = std::chrono::high_resolution_clock::now();
try
{
auto vm = eth::VMFactory::create(fev.gas);
auto vmtrace = Options::get().vmtrace ? fev.simpleTrace() : OnOpFunc{};
- output = vm->go(fev, vmtrace).toBytes();
+ auto outputRef = bytesConstRef{};
+ {
+ Listener::ExecTimeGuard guard{i.first};
+ outputRef = vm->go(fev, vmtrace);
+ }
+ output = outputRef.toBytes();
gas = vm->gas();
}
catch (VMException const&)
{
- cnote << "Safe VM Exception";
+ std::cout << " Safe VM Exception\n";
vmExceptionOccured = true;
}
catch (Exception const& _e)
@@ -364,15 +368,6 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
BOOST_ERROR("Failed VM Test with Exception: " << _e.what());
}
- auto endTime = std::chrono::high_resolution_clock::now();
- if (Options::get().showTimes)
- {
- auto testDuration = endTime - startTime;
- cnote << "Execution time: "
- << std::chrono::duration_cast<std::chrono::milliseconds>(testDuration).count()
- << " ms";
- }
-
// delete null entries in storage for the sake of comparison
for (auto &a: fev.addresses)
@@ -513,29 +508,13 @@ BOOST_AUTO_TEST_CASE(vmSystemOperationsTest)
BOOST_AUTO_TEST_CASE(vmPerformanceTest)
{
if (test::Options::get().performance)
- {
- auto start = chrono::steady_clock::now();
-
dev::test::executeTests("vmPerformanceTest", "/VMTests", dev::test::doVMTests);
-
- auto end = chrono::steady_clock::now();
- auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
- cnote << "test duration: " << duration.count() << " milliseconds.\n";
- }
}
BOOST_AUTO_TEST_CASE(vmInputLimitsTest1)
{
if (test::Options::get().inputLimits)
- {
- auto start = chrono::steady_clock::now();
-
dev::test::executeTests("vmInputLimits1", "/VMTests", dev::test::doVMTests);
-
- auto end = chrono::steady_clock::now();
- auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
- cnote << "test duration: " << duration.count() << " milliseconds.\n";
- }
}
BOOST_AUTO_TEST_CASE(vmInputLimitsTest2)
@@ -565,7 +544,7 @@ BOOST_AUTO_TEST_CASE(vmRandom)
{
try
{
- cnote << "Testing ..." << path.filename();
+ std::cout << "TEST " << path.filename() << "\n";
json_spirit::mValue v;
string s = asString(dev::contents(path.string()));
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Content of " + path.string() + " is empty. Have you cloned the 'tests' repo branch develop and set ETHEREUM_TEST_PATH to its path?");