<commit_before>/* 
* File:    overflow.c
* CVS:     $Id$
* Author:  <NAME>  [Based on tests/overflow.c by <NAME>]
*          <EMAIL>
* Mods:    <your name here>
*          <your email address>
*/

/* This file performs the following test: overflow dispatch

     The Eventset contains:
     + PAPI_TOT_CYC (overflow monitor)
     + PAPI_FP_INS

   - Start eventset 1
   - Do flops
   - Stop and measure eventset 1
   - Set up overflow on eventset 1
   - Start eventset 1
   - Do flops
   - Stop eventset 1
*/

#include "papi_test.h"

#ifdef _CRAYT3E
#define OVER_FMT    "handler(%d ) Overflow at %x! bit=0x%llx \n"
#define OUT_FMT     "%-12s : %16lld%16lld\n"
#elif defined(_WIN32)
#define OVER_FMT    "handler(%d ) Overflow at %p! bit=0x%llx \n"
#define OUT_FMT     "%-12s : %16I64d%16I64d\n"
#else
#define OVER_FMT    "handler(%d ) Overflow at %p! bit=0x%llx \n"
#define OUT_FMT     "%-12s : %16lld%16lld\n"
#endif

int total = 0;                  /* total overflows */
extern int TESTS_QUIET;         /* Declared in test_utils.c */

void handler(int EventSet, void *address, long_long overflow_vector, void *context)
{
   if (!TESTS_QUIET) {
      fprintf(stderr, OVER_FMT, EventSet, address, overflow_vector);
   }
   total++;
}

int main(int argc, char **argv)
{
   int EventSet=PAPI_NULL;
   long_long(values[2])[2];
   long_long min, max;
   int num_flops, retval;
   int PAPI_event, mythreshold;
   char event_name[PAPI_MAX_STR_LEN];

   tests_quiet(argc, argv);     /* Set TESTS_QUIET variable */

   retval = PAPI_library_init(PAPI_VER_CURRENT);
   if (retval != PAPI_VER_CURRENT)
      test_fail(__FILE__, __LINE__, "PAPI_library_init", retval);

   if (!TESTS_QUIET) {
      retval = PAPI_set_debug(PAPI_VERB_ECONT);
      if (retval != PAPI_OK)
         test_fail(__FILE__, __LINE__, "PAPI_set_debug", retval);
   }

#if defined(POWER3)
   PAPI_event = PAPI_TOT_INS;
#else
   /* query and set up the right instruction to monitor */
   if (PAPI_query_event(PAPI_FP_INS) == PAPI_OK)
      PAPI_event = PAPI_FP_INS;
   else
      if (PAPI_query_event(PAPI_FP_OPS) == PAPI_OK)
         PAPI_event = PAPI_FP_OPS;
      else
         PAPI_event = PAPI_TOT_INS;
#endif

   if ( PAPI_event == PAPI_FP_INS )
      mythreshold = THRESHOLD ;
   else 
      mythreshold = THRESHOLD * 2;
<commit_msg>use higher threshold defined by mhz for linux with software overflow.<commit_after>/* 
* File:    overflow.c
* CVS:     $Id$
* Author:  <NAME>  [Based on tests/overflow.c by <NAME>]
*          <EMAIL>
* Mods:    <your name here>
*          <your email address>
*/

/* This file performs the following test: overflow dispatch

     The Eventset contains:
     + PAPI_TOT_CYC (overflow monitor)
     + PAPI_FP_INS

   - Start eventset 1
   - Do flops
   - Stop and measure eventset 1
   - Set up overflow on eventset 1
   - Start eventset 1
   - Do flops
   - Stop eventset 1
*/

#include "papi_test.h"

#ifdef _CRAYT3E
#define OVER_FMT    "handler(%d ) Overflow at %x! bit=0x%llx \n"
#define OUT_FMT     "%-12s : %16lld%16lld\n"
#elif defined(_WIN32)
#define OVER_FMT    "handler(%d ) Overflow at %p! bit=0x%llx \n"
#define OUT_FMT     "%-12s : %16I64d%16I64d\n"
#else
#define OVER_FMT    "handler(%d ) Overflow at %p! bit=0x%llx \n"
#define OUT_FMT     "%-12s : %16lld%16lld\n"
#endif

int total = 0;                  /* total overflows */
extern int TESTS_QUIET;         /* Declared in test_utils.c */

void handler(int EventSet, void *address, long_long overflow_vector, void *context)
{
   if (!TESTS_QUIET) {
      fprintf(stderr, OVER_FMT, EventSet, address, overflow_vector);
   }
   total++;
}

int main(int argc, char **argv)
{
   int EventSet=PAPI_NULL;
   long_long(values[2])[2];
   long_long min, max;
   int num_flops, retval;
   int PAPI_event, mythreshold;
   char event_name[PAPI_MAX_STR_LEN];
   const PAPI_hw_info_t *hw_info = NULL;

   tests_quiet(argc, argv);     /* Set TESTS_QUIET variable */

   retval = PAPI_library_init(PAPI_VER_CURRENT);
   if (retval != PAPI_VER_CURRENT)
      test_fail(__FILE__, __LINE__, "PAPI_library_init", retval);

   if (!TESTS_QUIET) {
      retval = PAPI_set_debug(PAPI_VERB_ECONT);
      if (retval != PAPI_OK)
         test_fail(__FILE__, __LINE__, "PAPI_set_debug", retval);
   }

   hw_info = PAPI_get_hardware_info();
   if (hw_info == NULL)
     test_fail(__FILE__, __LINE__, "PAPI_get_hardware_info", 2);

#if defined(POWER3)
   PAPI_event = PAPI_TOT_INS;
#else
   /* query and set up the right instruction to monitor */
   if (PAPI_query_event(PAPI_FP_INS) == PAPI_OK)
      PAPI_event = PAPI_FP_INS;
   else
      if (PAPI_query_event(PAPI_FP_OPS) == PAPI_OK)
         PAPI_event = PAPI_FP_OPS;
      else
         PAPI_event = PAPI_TOT_INS;
#endif

   if ( PAPI_event == PAPI_FP_INS )
      mythreshold = THRESHOLD ;
   else 
#if defined(linux)
      mythreshold = hw_info->mhz*10000*2;
#else
      mythreshold = THRESHOLD*2;
#endif

{'fraction_non_alphanumeric': 0.11412821559820335, 'fraction_numerical': 0.01694569211923234, 'mean_word_length': 3.065560165975104, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1422734', 'n_tokens_mistral': 1931, 'n_tokens_neox': 1876, 'n_words': 454}