PAPI_strerror(3)

✨ NAME ✨

okay bestie, welcome to the PAPI_strerror(3) page β€” this is the one that tells you what a PAPI error code actually means. PAPI_strerror β€” Returns a string describing the PAPI error code. πŸ’…

🌸 SYNOPSIS 🌸

bestie, this page goes straight into the Detailed Description next, so keep scrolling. no cap, there’s no big synopsis block to memorize here. 🫢

πŸ’… Detailed Description πŸ’…

🌈 C Interface:

#include <papi.h>
char * PAPI_strerror( int errorCode );

πŸŽ€ Parameters πŸŽ€

  • code β€” the error code to interpret

πŸ“ Return values πŸ“

  • *error β€” a pointer to the error string.
  • NULL β€” the input error code to PAPI_strerror() is invalid.

So like, PAPI_strerror() returns a pointer to the error message corresponding to the error code code. If the call fails, the function returns the NULL pointer.

🚨 Fortran besties: this function is not implemented in Fortran.

πŸ”₯ Example: πŸ”₯

okay this example is giving β€œhandle your PAPI errors before chaos” energy, so here it is exactly:

int ret;
int EventSet = PAPI_NULL;
int native = 0x0;
char error_str[PAPI_MAX_STR_LEN];

ret = PAPI_create_eventset(&EventSet);
if (ret != PAPI_OK)
{
   fprintf(stderr, "PAPI error %d: %s\n", ret, PAPI_strerror(retval));
   exit(1);
}
// Add Total Instructions Executed to our EventSet
ret = PAPI_add_event(EventSet, PAPI_TOT_INS);
if (ret != PAPI_OK)
{
   PAPI_perror( "PAPI_add_event");
   fprintf(stderr,"PAPI_error %d: %s\n", ret, error_str);
   exit(1);
}
// Start counting
ret = PAPI_start(EventSet);
if (ret != PAPI_OK) handle_error(ret);

πŸ‘‘ See also πŸ‘‘

the whole squad:

  • PAPI_perror
  • PAPI_set_opt
  • PAPI_get_opt
  • PAPI_shutdown
  • PAPI_set_debug

🧚 Author 🧚

Generated automatically by Doxygen for PAPI from the source code. (yes bestie, the robots wrote this one πŸ€–πŸ’–)

kisses πŸ’‹ β€” this page is from Version 7.2.0.0, dated Wed Jun 25 2025 19:30:49. PAPI_strerror(3) out. periodt. 🫢