Commit 15d74a02 authored by Bednárek David RNDr. Ph.D.'s avatar Bednárek David RNDr. Ph.D.
Browse files

Mass evaluation support; bonus points

parent 86824989
...@@ -1953,6 +1953,73 @@ namespace fmwkng { ...@@ -1953,6 +1953,73 @@ namespace fmwkng {
using aggregator = element_t< root_tag< config_t>, sense>; using aggregator = element_t< root_tag< config_t>, sense>;
}; };
struct version_tag_category {};
struct version_tag {
using tag_category = version_tag_category;
};
template<>
struct tag_traits<version_tag>
{
static void code_tag(std::ostream& os)
{
os << "fmwkng::impl::version_tag";
}
};
template<>
struct element_traits< version_tag_category, version_tag, element_sense::OPEN>
{
static void metadata_marker(std::ostream& os)
{
}
using data_type = std::tuple< std::string, std::string, std::string>;
static void data_text(std::ostream& os, const data_type& d)
{
using std::get;
os << get<0>(d);
os << "\t" << get<1>(d);
os << "\t" << get<2>(d);
}
static void gold_comparison_text(std::ostream& os, const data_type& d, const data_type& gold_d)
{
assert(0);
}
static void code_data(std::ostream& os, const data_type& d)
{
assert(0);
}
static constexpr bool useful = false;
static constexpr bool reducible = false;
static bool relevant(element_relevance er)
{
return false;
}
template< element_sense sense>
using aggregator = element_t< version_tag, sense>;
static data_type aggregator_data(const data_type& v)
{
return v;
}
static void aggregate(data_type&, const data_type&)
{
// the first wins
}
};
template<>
struct element_traits< version_tag_category, version_tag, element_sense::CLOSE>
{
static void metadata_marker(std::ostream& os)
{
}
using data_type = void;
static constexpr bool reducible = false;
template< element_sense sense>
using aggregator = element_t< version_tag, sense>;
};
template< typename config_t> template< typename config_t>
class root_data_holder { class root_data_holder {
private: private:
...@@ -1991,19 +2058,22 @@ namespace fmwkng { ...@@ -1991,19 +2058,22 @@ namespace fmwkng {
template< typename dt_t> template< typename dt_t>
void entry(const dt_t&) void entry(const dt_t&)
{ {
push_element<root_tag<config_t>, element_sense::OPEN>( push_element<root_tag<config_t>, element_sense::OPEN>(
#ifdef NDEBUG #ifdef NDEBUG
machine_name_ machine_name_
#else #else
machine_name_ + "/Debug" machine_name_ + "/Debug"
#endif #endif
); );
push_element<version_tag, element_sense::OPEN>(std::make_tuple(
author_, commit_, date_));
//std::cout << "enter_root" << std::endl; //std::cout << "enter_root" << std::endl;
} }
template< typename dt_t> template< typename dt_t>
void exit(const dt_t&) void exit(const dt_t&)
{ {
push_element<version_tag, element_sense::CLOSE>();
push_element<root_tag<config_t>, element_sense::CLOSE>(); push_element<root_tag<config_t>, element_sense::CLOSE>();
//std::cout << "exit_root" << std::endl; //std::cout << "exit_root" << std::endl;
if (el_.has_paired()) if (el_.has_paired())
...@@ -2140,6 +2210,9 @@ namespace fmwkng { ...@@ -2140,6 +2210,9 @@ namespace fmwkng {
std::array< std::string, std::size_t(element_relevance::SIZE_)> code_fn_; std::array< std::string, std::size_t(element_relevance::SIZE_)> code_fn_;
gold_data gd_; gold_data gd_;
std::string machine_name_; std::string machine_name_;
std::string author_;
std::string commit_;
std::string date_;
bool direct_print_; bool direct_print_;
std::size_t threads_; std::size_t threads_;
...@@ -2224,11 +2297,16 @@ namespace fmwkng { ...@@ -2224,11 +2297,16 @@ namespace fmwkng {
auto cit = a.begin() + 2; auto cit = a.begin() + 2;
auto cite = find(cit, a.end(), '='); auto cite = find(cit, a.end(), '=');
auto name = std::string_view(&*cit, cite - cit); auto name = std::string_view(&*cit, cite - cit);
std::string_view value; std::string value;
if (cite != a.end()) if (cite != a.end())
{ {
value = std::string_view(&*cite + 1, a.end() - cite - 1); value = std::string_view(&*cite + 1, a.end() - cite - 1);
} }
while (it + 1 != arg.end() && (it[1][0] != '-' || it[1][1] != '-'))
{
value += " " + it[1];
++it;
}
if (name == "code-check") if (name == "code-check")
{ {
...@@ -2242,6 +2320,18 @@ namespace fmwkng { ...@@ -2242,6 +2320,18 @@ namespace fmwkng {
{ {
machine_name_ = value; machine_name_ = value;
} }
else if (name == "author")
{
author_ = value;
}
else if (name == "commit")
{
commit_ = value;
}
else if (name == "date")
{
date_ = value;
}
else if (name == "threads") else if (name == "threads")
{ {
try { try {
...@@ -3356,6 +3446,8 @@ namespace fmwkng { ...@@ -3356,6 +3446,8 @@ namespace fmwkng {
auto logratio = (d.first / d.second) - (gold_d.first / gold_d.second); auto logratio = (d.first / d.second) - (gold_d.first / gold_d.second);
//os << std::fixed << std::setprecision(0) << (std::exp(logratio)*100) << "%"; //os << std::fixed << std::setprecision(0) << (std::exp(logratio)*100) << "%";
os << std::exp(logratio); os << std::exp(logratio);
static double factor = -80.0 / std::log(10);
os << "\t" << (logratio * factor);
} }
static void code_data(std::ostream& os, const data_type& d) static void code_data(std::ostream& os, const data_type& d)
{ {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment