void stats_t::print(FILE* f) { fprintf(f, "launch_duration\t%.3lf\n", launch_duration); // fprintf(f, "relative_idle_time\t%.4lf\n", relative_idle); fprintf(f, "utilization\t%.4lf\n", utilization); bool stats_light = cmdline::parse_or_default_bool("stats_light", true, false); if (! stats_light) { fprintf(f, "total_sequential\t%.3lf\n", total_data.sequential_time); fprintf(f, "average_sequential\t%.3lf\n", average_sequentialized); fprintf(f, "relative_non_seq\t%.4lf\n", relative_non_seq); fprintf(f, "total_spinning_time\t%lf\n", total_spinning_time); for (int i = 0; i < NB_STATS; i++) fprintf(f, "%s\t%ld\n", name_of_type((stat_type_t) i).c_str(), (long)total_data.counters[i]); } else { const int nb_selected_stats = 3; int selected_stats[nb_selected_stats] = { THREAD_SEND, THREAD_EXEC, THREAD_ALLOC }; for (int k = 0; k < nb_selected_stats; k++) { int i = selected_stats[k]; fprintf(f, "%s\t%ld\n", name_of_type((stat_type_t) i).c_str(), (long)total_data.counters[i]); } } }
inline void get_member_signature_impl(T(*f)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, string_class& s) { s += "("; #if BOOST_PP_ITERATION() > 0 s += name_of_type(LUABIND_DECORATE_TYPE(A0), L, 0L); BOOST_PP_REPEAT(BOOST_PP_DEC(BOOST_PP_ITERATION()), LUABIND_ADD_LUA_TYPE_NAME, _) #endif s += ")"; }
inline void get_free_function_signature_impl(T(*f)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, std::string& s) { (void)f; s += "("; #if BOOST_PP_ITERATION() > 0 s += name_of_type(LUABIND_DECORATE_TYPE(A0), L, 0L); BOOST_PP_REPEAT(BOOST_PP_DEC(BOOST_PP_ITERATION()), LUABIND_ADD_LUA_TYPE_NAME, _) #endif s += ")"; }
CGOGN_IO_API std::string cgogn_name_of_type_to_vtk_xml_data_type(const std::string& cgogn_type) { static const std::map<std::string, std::string> type_map{ {name_of_type(int8()), "Int8"}, {name_of_type(uint8()), "UInt8"}, {name_of_type(int16()), "Int16"}, {name_of_type(uint16()), "UInt16"}, {name_of_type(int32()), "Int32"}, {name_of_type(uint32()), "UInt32"}, {name_of_type(int64()), "Int64"}, {name_of_type(uint64()), "UInt64"}, {name_of_type(float32()), "Float32"}, {name_of_type(float64()), "Float64"} }; const auto it = type_map.find(cgogn_type); if ( it != type_map.end()) return it->second; cgogn_log_error("cgogn_name_of_type_to_vtk_xml_data_type") << "Unknown cgogn type \"" << cgogn_type << "\"."; return std::string(); }
inline static void apply(string_class& s, lua_State* L, bool first) { if (!first) s += ", "; s += name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L); }
inline string_class name_of_type(by_value<luabind::functor<T> >, lua_State* L, long) { return "function<" + name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L) + ">"; }
string_class name_of_type(by_const_pointer<T>, lua_State* L, int) { return "const " + name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L) + "*"; };
string_class name_of_type(by_const_reference<T>, lua_State* L, int) { return "const " + name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L) + "&"; };
static void apply(lua_State* L, string_class& s) { s += "("; s += name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L); s += ")"; }
CGOGN_IO_API std::string cgogn_name_of_type_to_vtk_legacy_data_type(const std::string& cgogn_type) { static const std::map<std::string, std::string> type_map{ {name_of_type(bool()), "bit"}, {name_of_type(int8()), "char"}, {name_of_type(uint8()), "unsigned_char"}, {name_of_type(int16()), "short"}, {name_of_type(uint16()), "unsigned_short"}, {name_of_type(int32()), "int"}, {name_of_type(uint32()), "unsigned_int"}, {name_of_type(int64()), "long"}, {name_of_type(uint64()), "unsigned_long"}, {name_of_type(float32()), "float"}, {name_of_type(float64()), "double"} }; const auto it = type_map.find(cgogn_type); if ( it != type_map.end()) return it->second; cgogn_log_error("cgogn_name_of_type_to_vtk_legacy_data_type") << "Unknown cgogn type \"" << cgogn_type << "\"."; return std::string(); }
CGOGN_IO_API std::string vtk_data_type_to_cgogn_name_of_type(const std::string& vtk_type_str) { const std::string& data_type = to_lower(vtk_type_str); static const std::map<std::string, std::string> type_map{ {"char", name_of_type(int8())}, {"int8", name_of_type(int8())}, {"unsigned_char", name_of_type(uint8())}, {"uint8", name_of_type(uint8())}, {"short", name_of_type(int16())}, {"int16", name_of_type(int16())}, {"unsigned_short", name_of_type(uint16())}, {"uint16", name_of_type(uint16())}, {"int", name_of_type(int32())}, {"int32", name_of_type(int32())}, {"unsigned_int", name_of_type(uint32())}, {"uint32", name_of_type(uint32())}, {"long", name_of_type(int64())}, {"int64", name_of_type(int64())}, {"unsigned_long", name_of_type(uint64())}, {"uint64", name_of_type(uint64())}, {"float", name_of_type(float32())}, {"float32", name_of_type(float32())}, {"double", name_of_type(float64())}, {"float64", name_of_type(float64())} }; const auto it = type_map.find(data_type); if ( it != type_map.end()) return it->second; cgogn_log_error("vtk_data_type_to_cgogn_name_of_type") << "Unknown vtk type \"" << vtk_type_str << "\"."; return std::string(); }
std::string name_of_type(by_const_pointer<T>, lua_State* L) { return "const " + name_of_type(LUABIND_DECORATE_TYPE(T), L) + "*"; };
std::string name_of_type(by_const_reference<T>, lua_State* L) { return "const " + name_of_type(LUABIND_DECORATE_TYPE(T), L) + "&"; };
std::string name_of_type(by_pointer<T>, lua_State* L, int) { return name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L) + "*"; };
std::string name_of_type(by_reference<T>, lua_State* L, int) { return name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L) + "&"; };