Skip to content

Commit

Permalink
check High Level API return codes with papi_error decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
SerodioJ committed Feb 26, 2024
1 parent 5f29951 commit d9c6ea9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pypapi/papi_high.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
"""

from ._papi import lib, ffi
from .exceptions import papi_error


# int PAPI_hl_region_begin(const char* region); /**< read performance events at the beginning of a region */
@papi_error
def hl_region_begin(region):
"""hl_region_begin(region):
Expand All @@ -50,10 +52,11 @@ def hl_region_begin(region):
"""
cregion = ffi.new("char[]", region.encode("ascii"))
rcode = lib.PAPI_hl_region_begin(cregion)
return rcode
return rcode, rcode


# int PAPI_hl_read(const char* region);
@papi_error
def hl_read(region):
"""hl_read(region):
Expand All @@ -69,10 +72,11 @@ def hl_read(region):
"""
cregion = ffi.new("char[]", region.encode("ascii"))
rcode = lib.PAPI_hl_read(cregion)
return rcode
return rcode, rcode


# int PAPI_hl_region_end(const char* region);
@papi_error
def hl_region_end(region):
"""hl_region_end(region):
Expand All @@ -88,10 +92,11 @@ def hl_region_end(region):
"""
cregion = ffi.new("char[]", region.encode("ascii"))
rcode = lib.PAPI_hl_region_end(cregion)
return rcode
return rcode, rcode


# int PAPI_hl_stop();
@papi_error
def hl_stop():
"""hl_stop():
Expand All @@ -104,4 +109,4 @@ def hl_stop():
:raises PapiSystemError: A system or C library call failed inside PAPI.
"""
rcode = lib.PAPI_hl_stop()
return rcode
return rcode, rcode

0 comments on commit d9c6ea9

Please sign in to comment.