// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- /* * (c) 2017 Petr Ročkai * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #pragma once #include #include #include #include #include #include namespace benchmark { using namespace nanodbc; using namespace divine; using namespace std::literals; namespace fs = brick::fs; namespace odbc = divine::ui::odbc; struct Cmd { std::string _odbc; connection _conn; void setup(); virtual void run() = 0; }; struct Import : Cmd { std::string _name, _script, _variant; std::vector< std::string > _files, _tags; int _id; int modrev(); bool files(); void tag(); virtual void run() { if ( files() ) tag(); } }; struct JobBase : Cmd { std::string _tag; }; struct Schedule : JobBase { void run() override; }; struct ReportBase : Cmd { bool _by_tag = false, _watch = false; std::string _result = "VE"; std::string _agg = "avg"; }; struct Report : ReportBase { bool _list_instances = false; int _instance = -1; void list_instances(); void results(); void run() override { if ( _list_instances ) list_instances(); else results(); } }; struct Compare : ReportBase { std::vector< int > _instances; std::vector< std::string > _fields; void run() override; }; struct Run : JobBase { std::vector< std::pair< std::string, std::string > > _files; std::string _script; bool _done = false, _single = false; void prepare( int model ); void execute( int job ); void execute( int, ui::Verify & ); void execute( int, ui::Run & ) { NOT_IMPLEMENTED(); } virtual void run(); }; }