performance test

This commit is contained in:
CJentzsch 2015-02-13 09:00:51 +01:00
parent 48f6bda44b
commit 261c1e2a3f
2 changed files with 66 additions and 0 deletions

28
vm.cpp
View File

@ -32,6 +32,8 @@ using namespace dev;
using namespace dev::eth;
using namespace dev::test;
using Millisecs = chrono::duration<int,milli>;
FakeExtVM::FakeExtVM(eth::BlockInfo const& _previousBlock, eth::BlockInfo const& _currentBlock, unsigned _depth): /// TODO: XXX: remove the default argument & fix.
ExtVMFace(Address(), Address(), Address(), 0, 1, bytesConstRef(), bytes(), _previousBlock, _currentBlock, test::lastHashes(_currentBlock.number), _depth) {}
@ -513,13 +515,39 @@ BOOST_AUTO_TEST_CASE(vmSystemOperationsTest)
dev::test::executeTests("vmSystemOperationsTest", "/VMTests", dev::test::doVMTests);
}
BOOST_AUTO_TEST_CASE(vmPerformanceTest)
{
for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
{
string arg = boost::unit_test::framework::master_test_suite().argv[i];
if (arg == "--performance")
{
chrono::steady_clock::time_point start = chrono::steady_clock::now();
dev::test::executeTests("vmPerformanceTest", "/VMTests", dev::test::doVMTests);
chrono::steady_clock::time_point end = chrono::steady_clock::now();
Millisecs duration(chrono::duration_cast<Millisecs>(end - start));
cnote << "test duration: " << duration.count() << " milliseconds.\n";
}
}
}
BOOST_AUTO_TEST_CASE(vmInputLimitsTest1)
{
for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
{
string arg = boost::unit_test::framework::master_test_suite().argv[i];
if (arg == "--inputlimits")
{
chrono::steady_clock::time_point start = chrono::steady_clock::now();
dev::test::executeTests("vmInputLimitsTest1", "/VMTests", dev::test::doVMTests);
chrono::steady_clock::time_point end = chrono::steady_clock::now();
Millisecs duration(chrono::duration_cast<Millisecs>(end - start));
cnote << "test duration: " << duration.count() << " milliseconds.\n";
}
}
}

View File

@ -0,0 +1,38 @@
{
"ackermann33": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "100000000000",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : "0",
"//" : "contract PerformanceTester {",
"//" : " function ackermann(uint m, uint n) returns (uint) {",
"//" : " if (m == 0)",
"//" : " return n + 1;",
"//" : " if (n == 0)",
"//" : " return ackermann(m - 1, 1);",
"//" : " return ackermann(m - 1, ackermann(m, n - 1));",
"//" : " }",
"//" : "}",
"code" : "0x60e060020a6000350480632839e92814601457005b6020600435602435602a565b8060005260206000f35b6000826000146037576041565b8160010190506076565b81600014604c57605e565b6058600184036001602a565b90506076565b607360018403606f8560018603602a565b602a565b90505b9291505056",
"storage": {}
}
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000",
"data" : "0x2839e92800000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003",
"gasPrice" : "100000000000000",
"gas" : "100000000000"
}
}
}