You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement a decorator to manually instrument functions
* decorator can be used to specify user region names
* if no region name is specified the region is only added if the instrumenter is disabled
* fix a bug in the dummy instrumenter, which did not even lunch the program
Copy file name to clipboardExpand all lines: README.md
+27-5Lines changed: 27 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,17 +53,39 @@ with scorep.user.region("region_name"):
53
53
do_something()
54
54
```
55
55
56
-
The traditional calls to define a region and log some parameters, still exists:
56
+
Since version 2.1 the python bindings support also decorators for functions:
57
+
58
+
```
59
+
@scorep.user.region("region_name")
60
+
def do_something():
61
+
#do some things
62
+
```
63
+
If no region name is given, the function name will be used e.g.:
64
+
65
+
```
66
+
@scorep.user.region()
67
+
def do_something():
68
+
#do some things
69
+
```
70
+
71
+
will result in `__main__:do_something`.
72
+
73
+
The traditional calls to define a region still exists, but the usage is discouraged:
74
+
75
+
```
76
+
scorep.user.region_begin("region_name")
77
+
scorep.user.region_end("region_name")
78
+
```
79
+
80
+
User parameters can be used in any case:
57
81
58
82
```
59
-
scorep.user.region_begin(name)
60
83
scorep.user.parameter_int(name, val)
61
84
scorep.user.parameter_uint(name, val)
62
85
scorep.user.parameter_string(name, string)
63
-
scorep.user.region_end(name)
64
86
```
65
87
66
-
`name` defines the name of the parameter or region, while `val` or `string` represents the value that is passed to Score-P.
88
+
where `name` defines the name of the parameter or region, while `val` or `string` represents the value that is passed to Score-P.
67
89
68
90
Disabeling the recording with Score-P is still also possilbe:
69
91
@@ -72,7 +94,7 @@ scorep.user.enable_recording()
72
94
scorep.user.disable_recording()
73
95
```
74
96
75
-
However, please be aware that the runtime impact is rather small, as the instrumenter is still active. For details about the instrumenter, please see [Instrumenter](#Instrumenter).
97
+
However, please be aware that the runtime impact of disabeling Score-P is rather small, as the instrumenter is still active. For details about the instrumenter, please see [Instrumenter](#Instrumenter).
76
98
77
99
### Instrumenter
78
100
With version 2.0 of the python bindings, the term "instrumenter" is introduced. The instrumenter describes the class that maps the Python `trace` or `profile` events to Score-P. Please be aware, that `trace` and `profile` does not refer to the traditional Score-P terms of tracing and profiling, but to the Python functions [sys.settrace](https://docs.python.org/3/library/sys.html#sys.settrace) and [sys.setprofile](https://docs.python.org/3/library/sys.html#sys.setprofile).
0 commit comments