Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
bench_interp.cpp
Go to the documentation of this file.
1#include <sysio/vm/backend.hpp>
2#include <sysio/vm/error_codes.hpp>
3#include <sysio/vm/watchdog.hpp>
4
5#include <chrono>
6#include <iostream>
7
8using namespace sysio;
9using namespace sysio::vm;
10
11int main(int argc, char** argv) {
13
14 if (argc < 2) {
15 std::cerr << "Error, no wasm file provided\n";
16 return -1;
17 }
18 auto t3 = std::chrono::high_resolution_clock::now();
19 try {
20
21 auto code = read_wasm( argv[1] );
22
23 auto t1 = std::chrono::high_resolution_clock::now();
24 backend bkend( code, &wa );
25 auto t2 = std::chrono::high_resolution_clock::now();
26 std::cout << "Startup " << std::chrono::duration_cast<std::chrono::nanoseconds>(t2-t1).count() << "\n";
27
28 auto t3 = std::chrono::high_resolution_clock::now();
30 auto t4 = std::chrono::high_resolution_clock::now();
31 std::cout << "Execution " << std::chrono::duration_cast<std::chrono::nanoseconds>(t4-t3).count() << "\n";
32
33 } catch ( const sysio::vm::exception& ex ) {
34 auto t4 = std::chrono::high_resolution_clock::now();
35 std::cout << "Execution " << std::chrono::duration_cast<std::chrono::nanoseconds>(t4-t3).count() << "\n";
36 std::cerr << "sys-vm interpreter error\n";
37 std::cerr << ex.what() << " : " << ex.detail() << "\n";
38 }
39 return 0;
40}
wasm_allocator wa
Definition main.cpp:10
void execute_all(Watchdog &&wd, host_t &host)
Definition backend.hpp:219
backend_t bkend(hello_wasm, ehm, &wa)
char ** argv
std::vector< uint8_t > read_wasm(const std::string &fname)
Definition utils.hpp:30
virtual const char * what() const =0
virtual const char * detail() const =0