def libcore_profiler_profiler_reuse_test(): name = 'dos.library' fd = read_lib_fd(name) prof = LibProfiler() prof.parse_config(ConfigDict({ "names": [name], "calls": True })) prof.setup() p = prof.create_profile(name, fd) assert p f = p.get_func_by_name("Input") assert f idx = f.get_func_id() assert p.get_func_by_index(idx) == f f.count(1.0) # store/restore data = prof.get_data() prof2 = LibProfiler() assert prof2.set_data(data) prof2.setup() # reuse profile p2 = prof2.create_profile(name, fd) assert p == p2 f2 = p2.get_func_by_name("Input") assert f2.get_num_calls() == 1 f2.count(1.0) assert f2.get_num_calls() == 2 idx = f2.get_func_id() assert p2.get_func_by_index(idx) == f2
def libcore_profiler_profiler_reuse_test(): name = 'dos.library' fd = read_lib_fd(name) prof = LibProfiler() prof.parse_config(ConfigDict({ "names": [name], "calls": True })) prof.setup() p = prof.create_profile(name, fd) assert p f = p.get_func_by_name("Input") assert f idx = f.get_func_id() assert p.get_func_by_index(idx) == f f.count(1.0) # store/restore data = prof.get_data() prof2 = LibProfiler() assert prof2.set_data(data) prof2.setup() # reuse profile p2 = prof2.create_profile(name, fd) assert p == p2 f2 = p2.get_func_by_name("Input") assert f2.get_num_calls() == 1 f2.count(1.0) assert f2.get_num_calls() == 2 idx = f2.get_func_id() assert p2.get_func_by_index(idx) == f2
def libcore_profiler_profiler_set_get_data_test(): name = 'dos.library' fd = read_lib_fd(name) prof = LibProfiler(names=[name]) prof.setup() p = prof.create_profile(name, fd) data = prof.get_data() prof2 = LibProfiler() assert prof2.set_data(data) p2 = prof2.get_profile(name) assert p == p2
def libcore_profiler_profiler_set_get_data_test(): name = 'dos.library' fd = read_lib_fd(name) prof = LibProfiler(names=[name]) prof.setup() p = prof.create_profile(name, fd) data = prof.get_data() prof2 = LibProfiler() assert prof2.set_data(data) p2 = prof2.get_profile(name) assert p == p2
def libcore_profiler_profiler_config_test(): name = 'dos.library' fd = read_lib_fd(name) prof = LibProfiler() prof.parse_config(ConfigDict({"names": [name], "calls": True})) prof.setup() p = prof.create_profile(name, fd) data = prof.get_data() prof2 = LibProfiler() assert prof2.set_data(data) p2 = prof2.get_profile(name) assert p == p2
def libcore_profiler_profiler_config_test(): name = 'dos.library' fd = read_lib_fd(name) prof = LibProfiler() prof.parse_config(ConfigDict({ "names": [name], "calls": True })) prof.setup() p = prof.create_profile(name, fd) data = prof.get_data() prof2 = LibProfiler() assert prof2.set_data(data) p2 = prof2.get_profile(name) assert p == p2