Python support (#37)

* Initial python support

* Add python testing

* Increase timeout for bin tests

* cmake-format

* Valid build types + testing + formatting + more

- Enforce valid build types
- Fix to numpy install
- Increase testing timeout
- Fix to cmake format glob
- Fix to backtrace verbose

* Disable stripping libraries by default

* omnitrace exe updates

- new '--print-instructions' option
- changed format of instructions in JSON
- remove no-save-fpr tests

* Default to strip libraries when release build
Bu işleme şunda yer alıyor:
Jonathan R. Madsen
2022-04-05 00:24:34 -05:00
işlemeyi yapan: GitHub
ebeveyn 945f541965
işleme afa3edebab
42 değiştirilmiş dosya ile 2442 ekleme ve 239 silme
+1
Dosyayı Görüntüle
@@ -153,6 +153,7 @@ extern size_t min_instructions;
//
extern bool werror;
extern bool debug_print;
extern bool instr_print;
extern int verbose_level;
//
// string settings
+3 -3
Dosyayı Görüntüle
@@ -60,14 +60,14 @@ module_function::module_function(module_t* mod, procedure_t* proc)
flow_graph->getOuterLoops(loop_blocks);
}
instructions.reserve(basic_blocks.size());
for(const auto& itr : basic_blocks)
{
std::vector<instruction_t> _instructions{};
itr->getInstructions(_instructions);
num_instructions += _instructions.size();
instructions.reserve(instructions.size() + _instructions.size());
for(auto&& iitr : _instructions)
instructions.emplace_back(iitr);
if(debug_print || verbose_level > 3 || instr_print)
instructions.emplace_back(std::move(_instructions));
}
char modname[FUNCNAMELEN];
+19 -15
Dosyayı Görüntüle
@@ -77,18 +77,18 @@ struct module_function
bool is_address_range_constrained() const; // checks address range constraint
bool is_num_instructions_constrained() const; // check # instructions constraint
size_t start_address = 0;
uint64_t address_range = 0;
uint64_t num_instructions = 0;
module_t* module = nullptr;
procedure_t* function = nullptr;
flow_graph_t* flow_graph = nullptr;
string_t module_name = {};
string_t function_name = {};
function_signature signature = {};
basic_block_set_t basic_blocks = {};
basic_loop_vec_t loop_blocks = {};
std::vector<instruction_t> instructions = {};
size_t start_address = 0;
uint64_t address_range = 0;
uint64_t num_instructions = 0;
module_t* module = nullptr;
procedure_t* function = nullptr;
flow_graph_t* flow_graph = nullptr;
string_t module_name = {};
string_t function_name = {};
function_signature signature = {};
basic_block_set_t basic_blocks = {};
basic_loop_vec_t loop_blocks = {};
std::vector<std::vector<instruction_t>> instructions = {};
using str_msg_t = std::tuple<int, string_t, string_t, string_t>;
using str_msg_vec_t = std::vector<str_msg_t>;
@@ -198,13 +198,17 @@ module_function::serialize(ArchiveT& ar, const unsigned)
ar.finishNode();
// instructions can inflate JSON size so only output when verbosity is increased
// above default
if(verbose_level > 0)
if(debug_print || verbose_level > 3 || instr_print)
{
std::vector<std::string> _instructions{};
std::vector<std::vector<std::string>> _instructions{};
_instructions.reserve(instructions.size());
for(auto&& itr : instructions)
{
_instructions.emplace_back(itr.format());
std::vector<std::string> _subinstr{};
_subinstr.reserve(itr.size());
for(auto&& iitr : itr)
_subinstr.emplace_back(iitr.format());
_instructions.emplace_back(std::move(_subinstr));
}
ar(cereal::make_nvp("instructions", _instructions));
}
+7
Dosyayı Görüntüle
@@ -51,6 +51,7 @@ size_t min_loop_address_range = (1 << 8); // 256
size_t min_instructions = (1 << 6); // 64
bool werror = false;
bool debug_print = false;
bool instr_print = false;
int verbose_level = tim::get_env<int>("OMNITRACE_VERBOSE_INSTRUMENT", 0);
string_t main_fname = "main";
string_t argv0 = {};
@@ -356,6 +357,12 @@ main(int argc, char** argv)
.action([](parser_t& p) {
print_overlapping = p.get<std::string>("print-overlapping");
});
parser
.add_argument(
{ "--print-instructions" },
"Print the instructions for each basic-block in the JSON/XML outputs")
.max_count(1)
.action([](parser_t& p) { instr_print = p.get<bool>("print-instructions"); });
parser.add_argument({ "" }, "");
parser.add_argument({ "[MODE OPTIONS]" }, "");
+16 -8
Dosyayı Görüntüle
@@ -89,7 +89,7 @@ omnitrace_add_bin_test(
TARGET omnitrace-exe
ARGS --help
LABELS omnitrace-exe
TIMEOUT 15
TIMEOUT 45
PASS_REGULAR_EXPRESSION
".*\\\[omnitrace\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[MODE OPTIONS\\\].*\\\[LIBRARY OPTIONS\\\].*\\\[SYMBOL SELECTION OPTIONS\\\].*\\\[RUNTIME OPTIONS\\\].*\\\[GRANULARITY OPTIONS\\\].*\\\[DYNINST OPTIONS\\\].*"
)
@@ -97,8 +97,16 @@ omnitrace_add_bin_test(
omnitrace_add_bin_test(
NAME omnitrace-exe-simulate-ls
TARGET omnitrace-exe
ARGS --simulate --print-format json txt xml -- ls
TIMEOUT 60)
ARGS --simulate
--print-format
json
txt
xml
-v
1
--
ls
TIMEOUT 120)
omnitrace_add_bin_test(
NAME omnitrace-exe-simulate-ls-check
@@ -106,7 +114,7 @@ omnitrace_add_bin_test(
COMMAND ls
WORKING_DIRECTORY
${PROJECT_BINARY_DIR}/omnitrace-tests-output/omnitrace-exe-simulate-ls
TIMEOUT 30
TIMEOUT 60
PASS_REGULAR_EXPRESSION
".*available-instr.json.*available-instr.txt.*available-instr.xml.*excluded-instr.json.*excluded-instr.txt.*excluded-instr.xml.*instrumented-instr.json.*instrumented-instr.txt.*instrumented-instr.xml.*overlapping-instr.json.*overlapping-instr.txt.*overlapping-instr.xml.*"
)
@@ -116,7 +124,7 @@ omnitrace_add_bin_test(
TARGET omnitrace-avail
ARGS --help
LABELS omnitrace-avail
TIMEOUT 15
TIMEOUT 45
PASS_REGULAR_EXPRESSION
".*\\\[omnitrace-avail\\\] Usage:.*\\\[CATEGORIES\\\].*\\\[VIEW OPTIONS\\\].*\\\[COLUMN OPTIONS\\\].*\\\[WIDTH OPTIONS\\\].*\\\[OUTPUT OPTIONS\\\].*"
)
@@ -126,7 +134,7 @@ omnitrace_add_bin_test(
TARGET omnitrace-avail
ARGS -r wall_clock -C --available
LABELS omnitrace-avail
TIMEOUT 15
TIMEOUT 45
PASS_REGULAR_EXPRESSION
"\\\|[-]+\\\|\n\\\|[ ]+COMPONENT[ ]+\\\|\n\\\|[-]+\\\|\n\\\| (wall_clock)[ ]+\\\|\n\\\| (sampling_wall_clock)[ ]+\\\|\n\\\|[-]+\\\|"
)
@@ -136,7 +144,7 @@ omnitrace_add_bin_test(
TARGET omnitrace-avail
ARGS --categories settings::omnitrace --brief
LABELS omnitrace-avail
TIMEOUT 15
TIMEOUT 45
PASS_REGULAR_EXPRESSION "OMNITRACE_(SETTINGS_DESC|OUTPUT_FILE|OUTPUT_PREFIX)"
FAIL_REGULAR_EXPRESSION
"OMNITRACE_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)"
@@ -147,7 +155,7 @@ omnitrace_add_bin_test(
TARGET omnitrace-avail
ARGS --categories settings::timemory --brief
LABELS omnitrace-avail
TIMEOUT 15
TIMEOUT 45
PASS_REGULAR_EXPRESSION
"OMNITRACE_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)"
FAIL_REGULAR_EXPRESSION "OMNITRACE_(SETTINGS_DESC|OUTPUT_FILE)")