91627797a0
* Support external (i.e. user-defined) trace annotations
- tweaked the python examples to be more balanced
- updated the user-api example to conform to user API changes
- moved the get/set for State and ThreadState to state.{hpp,cpp}
- introduced user-provided trace annotations
- added perfetto python category
- moved coverage impl files around
- created enumerations for mapping category enums to category types
- created enumerations for mapping annotation type enums to annotation values
- moved tracing::add_perfetto_annotations to tracing/annotation.hpp
- utility make_index_sequence_range
- libomnitrace-dl: omnitrace_push_category_region
- libomnitrace-dl: omnitrace_pop_category_region
- libomnitrace-user: omnitrace_user_push_annotated_region
- libomnitrace-user: omnitrace_user_pop_annotated_region
- libpyomnitrace: support extra annotations via annotate_trace config value
- filename
- line
- last attempted instr in bytecode (lasti)
- argcount
- num local variables
- stacksize
- omnitrace-python: -a / --annotate-traces option
* tweak ubuntu-focal workflow
* Fix installation of omnitrace-user headers
* ubuntu-focal-codecov workflow update
- Install texinfo
* Update timemory submodule
[ROCm/rocprofiler-systems commit: 642b6b95ca]
48 wiersze
1.1 KiB
Python
Executable File
48 wiersze
1.1 KiB
Python
Executable File
#!@PYTHON_EXECUTABLE@
|
|
|
|
import os
|
|
import sys
|
|
import random
|
|
|
|
_prefix = ""
|
|
|
|
|
|
def fib(n):
|
|
return n if n < 2 else (fib(n - 1) + fib(n - 2))
|
|
|
|
|
|
def inefficient(n):
|
|
print(f"[{_prefix}] ... running inefficient({n})")
|
|
a = 0
|
|
for i in range(n):
|
|
a += i
|
|
for j in range(n):
|
|
a += j
|
|
_len = a * n * n
|
|
_arr = [random.random() for _ in range(_len)]
|
|
_sum = sum(_arr)
|
|
print(f"[{_prefix}] ... sum of {_len} random elements: {_sum}")
|
|
return _sum
|
|
|
|
|
|
def run(n):
|
|
_ret = 0
|
|
_ret += fib(n)
|
|
_ret += inefficient(n)
|
|
return _ret
|
|
|
|
|
|
if __name__ == "__main__":
|
|
import argparse
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("-n", "--num-iterations", help="Number", type=int, default=3)
|
|
parser.add_argument("-v", "--value", help="Starting value", type=int, default=20)
|
|
args = parser.parse_args()
|
|
|
|
_prefix = os.path.basename(__file__)
|
|
print(f"[{_prefix}] Executing {args.num_iterations} iterations...\n")
|
|
for i in range(args.num_iterations):
|
|
ans = run(args.value)
|
|
print(f"[{_prefix}] [{i}] result of run({args.value}) = {ans}\n")
|