def libcore_profile_profiler_test(): name = 'vamostest.library' fd = read_lib_fd(name) c = LibProfilerConfig(profiling=True, libs=[name]) p = LibProfiler(c) assert not p.get_profile(name) prof = p.create_profile(name, fd) assert prof assert prof == p.get_profile(name) assert p.get_all_lib_names() == [name] assert p.get_num_libs() == 1
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_profile_profiler_default_test(): name = 'dos.library' fd = read_lib_fd(name) prof = LibProfiler(names=[name]) prof.setup() p = prof.create_profile(name, fd) assert p assert prof.create_profile('bla', fd) is None assert prof.get_profile(name) == p assert prof.get_num_libs() == 1 assert prof.get_all_lib_names() == [name] prof.shutdown()
def libcore_profile_profiler_default_test(): name = 'dos.library' fd = read_lib_fd(name) prof = LibProfiler(names=[name]) prof.setup() p = prof.create_profile(name, fd) assert p assert prof.create_profile('bla', fd) is None assert prof.get_profile(name) == p assert prof.get_num_libs() == 1 assert prof.get_all_lib_names() == [name] prof.shutdown()
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
def libcore_create_lib_profile_test(): mem, traps, alloc, ctx = setup() impl = VamosTestLibrary() # create info for lib date = datetime.date(2012, 11, 12) info = LibInfo('vamostest.library', 42, 3, date) # create lib pc = LibProfilerConfig(profiling=True, all_libs=True) profiler = LibProfiler(pc) creator = LibCreator(alloc, traps, profiler=profiler) lib = creator.create_lib(info, ctx, impl) prof = profiler.get_profile('vamostest.library') assert prof # free lib lib.free() assert alloc.is_all_free()