<commit_before>/* This file performs the following test: start, stop and timer functionality for
   attached processes.

   - It attempts to use the following two counters. It may use less depending on
     hardware counter resource limitations. 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).
     + PAPI_FP_INS
     + PAPI_TOT_CYC
   - Get us.
   - Start counters
   - Do flops
   - Stop and read counters
   - Get us.
*/

#include "papi_test.h"
#include <sys/ptrace.h>

int wait_for_attach_and_loop(void)
{
  kill( getpid(), SIGSTOP );
  do_flops(NUM_FLOPS);
  kill( getpid(), SIGSTOP );
  return(0);
}

int main(int argc, char **argv)
{
   int status, retval, num_tests = 1, tmp;
   int EventSet1=PAPI_NULL;
   int PAPI_event, mask1;
   int num_events1;
   long long **values;
   long long elapsed_us, elapsed_cyc, elapsed_virt_us, elapsed_virt_cyc;
   char event_name[PAPI_MAX_STR_LEN], add_event_str[PAPI_MAX_STR_LEN];
   const PAPI_hw_info_t *hw_info;
   const PAPI_component_info_t *cmpinfo;
   unsigned long pid;

   pid = fork();
   if (pid < 0)
     test_fail(__FILE__,__LINE__,"fork()",PAPI_ESYS);
   if (pid == 0)
     exit(wait_for_attach_and_loop());

   tests_quiet(argc, argv);     /* Set TESTS_QUIET variable */<commit_msg>corrected logic error with pid type<commit_after>/* This file performs the following test: start, stop and timer functionality for
   attached processes.

   - It attempts to use the following two counters. It may use less depending on
     hardware counter resource limitations. 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).
     + PAPI_FP_INS
     + PAPI_TOT_CYC
   - Get us.
   - Start counters
   - Do flops
   - Stop and read counters
   - Get us.
*/

#include "papi_test.h"
#include <sys/ptrace.h>

int wait_for_attach_and_loop(void)
{
  kill( getpid(), SIGSTOP );
  do_flops(NUM_FLOPS);
  kill( getpid(), SIGSTOP );
  return(0);
}

int main(int argc, char **argv)
{
   int status, retval, num_tests = 1, tmp;
   int EventSet1=PAPI_NULL;
   int PAPI_event, mask1;
   int num_events1;
   long long **values;
   long long elapsed_us, elapsed_cyc, elapsed_virt_us, elapsed_virt_cyc;
   char event_name[PAPI_MAX_STR_LEN], add_event_str[PAPI_MAX_STR_LEN];
   const PAPI_hw_info_t *hw_info;
   const PAPI_component_info_t *cmpinfo;
   pid_t pid;

   pid = fork();
   if (pid < 0)
     test_fail(__FILE__,__LINE__,"fork()",PAPI_ESYS);
   if (pid == 0)
     exit(wait_for_attach_and_loop());

   tests_quiet(argc, argv);     /* Set TESTS_QUIET variable */
{'fraction_non_alphanumeric': 0.09175627240143369, 'fraction_numerical': 0.005017921146953405, 'mean_word_length': 3.659432387312187, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '6478173', 'n_tokens_mistral': 991, 'n_tokens_neox': 960, 'n_words': 286}