<commit_before>/* 
* File:    profile.c
* CVS:     $Id$
* Author:  <NAME>
*          <EMAIL>
* Mods:    <your name here>
*          <your email address>
*/  

#define NUM 500
#define THR 10000

/* This file performs the following test: profiling and program info option call

   - This tests the SVR4 profiling interface of PAPI. These are counted 
   in the default counting domain and default granularity, depending on 
   the platform. Usually this is the user domain (PAPI_DOM_USER) and 
   thread context (PAPI_GRN_THR).

     The Eventset contains:
     + PAPI_FP_INS (to profile)
     + PAPI_TOT_CYC

   - Set up profile
   - Start eventset 1
   - Do flops
   - Stop eventset 1
*/

#include "papi_test.h"

extern int TESTS_QUIET; /* Declared in test_utils.c */

int main(int argc, char **argv) 
{
  int i, num_events, num_tests = 6;
  int PAPI_event, mask;
  char event_name[PAPI_MAX_STR_LEN];
  int EventSet = PAPI_NULL;
  unsigned short *profbuf;
  unsigned short *profbuf2;
  unsigned short *profbuf3;
  unsigned short *profbuf4;
  unsigned short *profbuf5;
  unsigned long length;
  unsigned long start, end;
  long_long **values;
  const PAPI_exe_info_t *prginfo = NULL;
  int retval;

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

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

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

#if defined(sun) && defined(sparc)
   /* query and set up the right instruction to monitor */
  if (PAPI_query_event(PAPI_TOT_INS) == PAPI_OK) {
	  PAPI_event = PAPI_TOT_INS;
	  mask = MASK_TOT_INS | MASK_TOT_CYC;
  } else     test_fail(__FILE__, __LINE__, "PAPI_TOT_INS not available on this Sun platform!",0);
#else
  if (PAPI_query_event(PAPI_FP_INS) == PAPI_OK) {
	  PAPI_event = PAPI_FP_INS;
	  mask = MASK_FP_INS | MASK_TOT_CYC;
  }
  else {
	  PAPI_event = PAPI_TOT_INS;
	  mask = MASK_TOT_INS | MASK_TOT_CYC;
  }
#endif

  if ((retval = PAPI_event_code_to_name(PAPI_event, event_name)) != PAPI_OK)
	  test_fail(__FILE__, __LINE__, "PAPI_event_code_to_name", retval);

 if ((prginfo = PAPI_get_executable_info()) == NULL){
	retval=1;
	test_fail(__FILE__,__LINE__,"PAPI_get_executable_info",retval);
  }
  start = (unsigned long)prginfo->text_start;
  end =  (unsigned long)prginfo->text_end;
  length = end - start;

  profbuf = (unsigned short *)malloc(length*sizeof(unsigned short));
  if (profbuf == NULL){
	retval=PAPI_ESYS;
	test_fail(__FILE__,__LINE__,"malloc",retval);
  }
  memset(profbuf,0x00,length*sizeof(unsigned short));
  profbuf2 = (unsigned short *)malloc(length*sizeof(unsigned short));
  if (profbuf2 == NULL){
	retval=PAPI_ESYS;
	test_fail(__FILE__,__LINE__,"malloc",retval);<commit_msg>*** empty log message ***<commit_after>/* 
* File:    profile.c
* CVS:     $Id$
* Author:  <NAME>
*          <EMAIL>
* Mods:    <your name here>
*          <your email address>
*/  

#define NUM 500
#define THR 10000

/* This file performs the following test: profiling and program info option call

   - This tests the SVR4 profiling interface of PAPI. These are counted 
   in the default counting domain and default granularity, depending on 
   the platform. Usually this is the user domain (PAPI_DOM_USER) and 
   thread context (PAPI_GRN_THR).

     The Eventset contains:
     + PAPI_FP_INS (to profile)
     + PAPI_TOT_CYC

   - Set up profile
   - Start eventset 1
   - Do flops
   - Stop eventset 1
*/

#include "papi_test.h"

extern int TESTS_QUIET; /* Declared in test_utils.c */

int main(int argc, char **argv) 
{
  int i, num_events, num_tests = 6;
  int PAPI_event, mask;
  char event_name[PAPI_MAX_STR_LEN];
  int EventSet = PAPI_NULL;
  unsigned short *profbuf;
  unsigned short *profbuf2;
  unsigned short *profbuf3;
  unsigned short *profbuf4;
  unsigned short *profbuf5;
  unsigned long length;
  unsigned long start, end;
  long_long **values;
  const PAPI_exe_info_t *prginfo = NULL;
  int retval;

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

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

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

#if defined(sun) && defined(sparc)
   /* query and set up the right instruction to monitor */
  if (PAPI_query_event(PAPI_TOT_INS) == PAPI_OK) {
	  PAPI_event = PAPI_TOT_INS;
	  mask = MASK_TOT_INS | MASK_TOT_CYC;
  } else     test_fail(__FILE__, __LINE__, "PAPI_TOT_INS not available on this Sun platform!",0);
#else
  if (PAPI_query_event(PAPI_FP_INS) == PAPI_OK) {
	  PAPI_event = PAPI_FP_INS;
	  mask = MASK_FP_INS | MASK_TOT_CYC;
  }
  else {
	  PAPI_event = PAPI_TOT_INS;
	  mask = MASK_TOT_INS | MASK_TOT_CYC;
  }
#endif
#if !( defined(linux) && defined(__ia64__) )
	  test_fail(__FILE__, __LINE__, "PAPI_profile_hw not support", PAPI_ESYS);
#endif

  if ((retval = PAPI_event_code_to_name(PAPI_event, event_name)) != PAPI_OK)
	  test_fail(__FILE__, __LINE__, "PAPI_event_code_to_name", retval);

 if ((prginfo = PAPI_get_executable_info()) == NULL){
	retval=1;
	test_fail(__FILE__,__LINE__,"PAPI_get_executable_info",retval);
  }
  start = (unsigned long)prginfo->text_start;
  end =  (unsigned long)prginfo->text_end;
  length = end - start;

  profbuf = (unsigned short *)malloc(length*sizeof(unsigned short));
  if (profbuf == NULL){
	retval=PAPI_ESYS;
	test_fail(__FILE__,__LINE__,"malloc",retval);
  }
  memset(profbuf,0x00,length*sizeof(unsigned short));
  profbuf2 = (unsigned short *)malloc(length*sizeof(unsigned short));
  if (profbuf2 == NULL){
	retval=PAPI_ESYS;
	test_fail(__FILE__,__LINE__,"malloc",retval);
{'fraction_non_alphanumeric': 0.111740473738414, 'fraction_numerical': 0.008238928939237899, 'mean_word_length': 4.331198536139067, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '4855816', 'n_tokens_mistral': 2233, 'n_tokens_neox': 2154, 'n_words': 509}