Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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
Exemplo n.º 4
0
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
Exemplo n.º 5
0
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()
Exemplo n.º 6
0
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()
Exemplo n.º 7
0
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
Exemplo n.º 8
0
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
Exemplo n.º 9
0
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
    lib_profiler = LibProfiler(names=["all"])
    creator = LibCreator(alloc, traps, lib_profiler=lib_profiler)
    lib_profiler.setup()
    lib = creator.create_lib(info, ctx, impl)
    profiler = creator.get_profiler()
    prof = profiler.get_profile('vamostest.library')
    assert prof
    assert lib.profile
    # free lib
    lib.free()
    assert alloc.is_all_free()