这篇教程C++ test_skip函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中test_skip函数的典型用法代码示例。如果您正苦于以下问题:C++ test_skip函数的具体用法?C++ test_skip怎么用?C++ test_skip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了test_skip函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mainintmain( int argc, char **argv ){ int i, retval; long long elapsed_us, elapsed_cyc; 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 ); elapsed_us = PAPI_get_real_usec( ); elapsed_cyc = PAPI_get_real_cyc( );#if defined(_AIX) retval = PAPI_thread_init( ( unsigned long ( * )( void ) ) ( pthread_self ) ); if ( retval != PAPI_OK ) { if ( retval == PAPI_ECMP ) test_skip( __FILE__, __LINE__, "PAPI_thread_init", retval ); else test_fail( __FILE__, __LINE__, "PAPI_thread_init", retval ); }#pragma ibm parallel_loop#elif defined(sgi) && defined(mips) retval = PAPI_thread_init( ( unsigned long ( * )( void ) ) ( mp_my_threadnum ) ); if ( retval != PAPI_OK ) { test_fail( __FILE__, __LINE__, "PAPI_thread_init", retval ); }#pragma parallel#pragma local(i)#pragma pfor#elif defined(sun) && defined(sparc) retval = PAPI_thread_init( ( unsigned long ( * )( void ) ) ( thr_self ) ); if ( retval != PAPI_OK ) { test_fail( __FILE__, __LINE__, "PAPI_thread_init", retval ); }#pragma MP taskloop private(i)#else test_skip(__FILE__, __LINE__, "Architecture not included in this test file yet.", 0);#endif for ( i = 1; i < 3; i++ ) Thread( i, 10000000 * i ); elapsed_cyc = PAPI_get_real_cyc( ) - elapsed_cyc; elapsed_us = PAPI_get_real_usec( ) - elapsed_us; if ( !TESTS_QUIET ) { printf( "Master real usec : /t%lld/n", elapsed_us ); printf( "Master real cycles : /t%lld/n", elapsed_cyc ); } test_pass( __FILE__, NULL, 0 ); exit( 1 );}
开发者ID:DanieleDeSensi,项目名称:mammut,代码行数:58,
示例2: mainint main(int argc, char **argv){ pthread_t slaves[MAX_THREADS]; int rc, i, nthr; int retval; const PAPI_hw_info_t *hwinfo = NULL;#if defined(__ALPHA) && defined(__osf__) test_skip(__FILE__, __LINE__, "thread support not available on this platform!", PAPI_ESBSTR);#endif 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 ((hwinfo = PAPI_get_hardware_info()) == NULL) test_fail(__FILE__, __LINE__, "PAPI_get_hardware_info", 2); retval = PAPI_thread_init((unsigned long (*)(void)) (pthread_self)); if (retval != PAPI_OK) { if (retval == PAPI_ESBSTR) test_skip(__FILE__, __LINE__, "PAPI_thread_init", retval); else test_fail(__FILE__, __LINE__, "PAPI_thread_init", retval); } if (hwinfo->ncpu > MAX_THREADS) nthr = MAX_THREADS; else nthr = hwinfo->ncpu; printf("Creating %d threads/n", nthr); for (i=0;i<nthr;i++) { rc = pthread_create(&slaves[i], NULL, Slave, NULL); if (rc) { retval = PAPI_ESYS; test_fail(__FILE__, __LINE__, "pthread_create", retval); } } for (i=0;i<nthr;i++) { pthread_join(slaves[i], NULL); } printf("Expected: %lld Received: %lld/n", (long long)nthr*num_iters, count); if (nthr*num_iters != count) test_fail(__FILE__, __LINE__, "Thread Locks", 1); test_pass(__FILE__, NULL, 0); exit(1);}
开发者ID:tcreech,项目名称:papi-4.0.0-64-solaris11.2,代码行数:55,
示例3: mainint main(int argc, char *argv[]) { log_set_max_level(LOG_DEBUG); arg_keep = argc > 1; test_skip(setup_sequential); test_skip(setup_interleaved); test_sequence_numbers(); return 0;}
开发者ID:Miss6yka,项目名称:systemd,代码行数:12,
示例4: mainint main(int argc, char **argv){ pthread_t t1, t2, t3, t4; pthread_attr_t attr; 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); retval = PAPI_thread_init((unsigned long (*)(void)) (pthread_self)); if (retval != PAPI_OK) { if (retval == PAPI_ESBSTR) test_skip(__FILE__, __LINE__, "PAPI_thread_init", retval); else test_fail(__FILE__, __LINE__, "PAPI_thread_init", retval); } if (!TESTS_QUIET) { printf("Test case: Clock latency and resolution./n"); printf("Note: Virtual timers are proportional to # CPU's./n"); printf("-------------------------------------------------/n"); } pthread_attr_init(&attr);#ifdef PTHREAD_CREATE_UNDETACHED pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);#endif#ifdef PTHREAD_SCOPE_SYSTEM retval = pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); if (retval != 0) test_skip(__FILE__, __LINE__, "pthread_attr_setscope", retval);#endif pthread_create(&t1, &attr, pthread_main, NULL); pthread_create(&t2, &attr, pthread_main, NULL); pthread_create(&t3, &attr, pthread_main, NULL); pthread_create(&t4, &attr, pthread_main, NULL); pthread_main(NULL); pthread_join(t1, NULL); pthread_join(t2, NULL); pthread_join(t3, NULL); pthread_join(t4, NULL); test_pass(__FILE__, NULL, 0); exit(0);}
开发者ID:tcreech,项目名称:papi-4.0.0-64-solaris11.2,代码行数:49,
示例5: mainintmain( int argc, char **argv ){ int i, rc, retval; pthread_t id[NUM_THREADS]; pthread_attr_t attr; tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */ printf( "%s: Using %d threads/n/n", argv[0], NUM_THREADS ); printf ( "Does non-threaded overflow work with extraneous threads present?/n" ); pthread_attr_init( &attr );#ifdef PTHREAD_CREATE_UNDETACHED pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_UNDETACHED );#endif#ifdef PTHREAD_SCOPE_SYSTEM retval = pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM ); if ( retval != 0 ) test_skip( __FILE__, __LINE__, "pthread_attr_setscope", retval );#endif for ( i = 0; i < NUM_THREADS; i++ ) { rc = pthread_create( &id[i], &attr, thread_fn, NULL ); if ( rc ) test_fail( __FILE__, __LINE__, "pthread_create", rc ); } pthread_attr_destroy( &attr ); mainloop( NUM_ITERS ); test_pass( __FILE__, NULL, 0 ); exit( 1 );}
开发者ID:DanieleDeSensi,项目名称:mammut,代码行数:35,
示例6: mainint main(int argc, char *argv[]) { log_set_max_level(LOG_DEBUG); /* journal_file_open requires a valid machine id */ if (access("/etc/machine-id", F_OK) != 0) return EXIT_TEST_SKIP; arg_keep = argc > 1; test_skip(setup_sequential); test_skip(setup_interleaved); test_sequence_numbers(); return 0;}
开发者ID:samveen,项目名称:uselessd,代码行数:16,
示例7: decide_which_eventsvoid decide_which_events(int *events, int *nevents){ int i, j = 0; PAPI_event_info_t info; int newevents[MAXEVENTS]; for (i = 0; i < MAXEVENTS; i++) { if (PAPI_get_event_info(events[i], &info) == PAPI_OK) { if (info.count && (strcmp(info.derived,"NOT_DERIVED") == 0)) { printf("Added %s/n", info.symbol); newevents[j++] = events[i]; } } } if (j < 2) test_skip(__FILE__, __LINE__, "Not enough events to multiplex...", 0); *nevents = j; memcpy(events,newevents,sizeof(newevents)); printf("Using %d events/n/n",*nevents);}
开发者ID:tcreech,项目名称:papi-4.0.0-64-solaris11.2,代码行数:25,
示例8: test_plan_skip_allvoid test_plan_skip_all(const char *reason){ if (test_num < test_cases) { test_skip(reason, test_cases - test_num, 0); }}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:7,
示例9: test_io_closestatic voidtest_io_close(int with_timer, bool from_path){ #define chunks 4 #define READSIZE (512*1024) unsigned int i; const char *path = LARGE_FILE; int fd = open(path, O_RDONLY); if (fd == -1) { if (errno == ENOENT) { test_skip("Large file not found"); return; } test_errno("open", errno, 0); test_stop(); }#ifdef F_GLOBAL_NOCACHE if (fcntl(fd, F_GLOBAL_NOCACHE, 1) == -1) { test_errno("fcntl F_GLOBAL_NOCACHE", errno, 0); test_stop(); }#endif struct stat sb; if (fstat(fd, &sb)) { test_errno("fstat", errno, 0); test_stop(); } const size_t size = (size_t)sb.st_size / chunks; const int expected_error = with_timer? ECANCELED : 0; dispatch_source_t t = NULL; dispatch_group_t g = dispatch_group_create(); dispatch_group_enter(g); void (^cleanup_handler)(int error) = ^(int error) { test_errno("create error", error, 0); dispatch_group_leave(g); close(fd); }; dispatch_io_t io; if (!from_path) { io = dispatch_io_create(DISPATCH_IO_RANDOM, fd, dispatch_get_global_queue(0, 0), cleanup_handler); } else {#if DISPATCHTEST_IO_PATH io = dispatch_io_create_with_path(DISPATCH_IO_RANDOM, path, O_RDONLY, 0, dispatch_get_global_queue(0, 0), cleanup_handler);#endif } dispatch_io_set_high_water(io, READSIZE); if (with_timer == 1) { dispatch_io_set_low_water(io, READSIZE); dispatch_io_set_interval(io, 2 * NSEC_PER_SEC, DISPATCH_IO_STRICT_INTERVAL); } else if (with_timer == 2) { t = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(0,0)); dispatch_retain(io); dispatch_source_set_event_handler(t, ^{ dispatch_io_close(io, DISPATCH_IO_STOP); dispatch_source_cancel(t); });
开发者ID:helje5,项目名称:swift-corelibs-libdispatch,代码行数:60,
示例10: test_skip_file_and_functionvoidtest_skip_file_and_function (void){ test_skip (); skip1_test_skip_file_and_function (); end_test_skip_file_and_function ();}
开发者ID:Distrotech,项目名称:binutils,代码行数:7,
示例11: mainint main(int argc, char **argv){ int rval = 0; printf("Testing read functions ... "); rval = test_read(); if (rval != 0) { fprintf(stderr, "FAILED!/n"); return (-1); } else { printf("passed!/n"); } printf("Testing skip functions ... "); rval = test_skip(); if (rval != 0) { fprintf(stderr, "FAILED!/n"); return (-1); } else { printf("passed!/n"); } printf("Testing position functions ... "); rval = test_position(); if (rval != 0) { fprintf(stderr, "FAILED!/n"); return (-1); } else { printf("passed!/n"); } return (0);}
开发者ID:brainey421,项目名称:libbvg,代码行数:32,
示例12: test_plan_skip_allvoid test_plan_skip_all(const char *reason){ if (test_num > test_cases) { test_skip(reason, test_cases - test_num, 0); exit(test_fails > 255 ? 255 : test_fails); }}
开发者ID:Apple-FOSS-Mirror,项目名称:CommonCrypto,代码行数:8,
示例13: mainintmain( int argc, char **argv ){ int i, rc, retval; pthread_t id[NUM_THREADS]; pthread_attr_t attr; tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */ printf( "%s: Using %d threads/n/n", argv[0], NUM_THREADS ); printf ( "Does non-threaded multiplexing work with extraneous threads present?/n" ); /* Create a bunch of unused pthreads, to simulate threads created * by the system that the user doesn't know about. */ pthread_attr_init( &attr );#ifdef PTHREAD_CREATE_UNDETACHED pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_UNDETACHED );#endif#ifdef PTHREAD_SCOPE_SYSTEM retval = pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM ); if ( retval != 0 ) test_skip( __FILE__, __LINE__, "pthread_attr_setscope", retval );#endif#ifdef PPC64 sigset_t sigprof; sigemptyset( &sigprof ); sigaddset( &sigprof, SIGPROF ); retval = sigprocmask( SIG_BLOCK, &sigprof, NULL ); if ( retval != 0 ) test_fail( __FILE__, __LINE__, "sigprocmask SIG_BLOCK", retval );#endif for ( i = 0; i < NUM_THREADS; i++ ) { rc = pthread_create( &id[i], &attr, thread_fn, NULL ); if ( rc ) test_fail( __FILE__, __LINE__, "pthread_create", rc ); } pthread_attr_destroy( &attr );#ifdef PPC64 retval = sigprocmask( SIG_UNBLOCK, &sigprof, NULL ); if ( retval != 0 ) test_fail( __FILE__, __LINE__, "sigprocmask SIG_UNBLOCK", retval );#endif mainloop( NUM_ITERS ); test_pass( __FILE__, NULL, 0 ); exit( 0 );}
开发者ID:DanieleDeSensi,项目名称:mammut,代码行数:53,
示例14: mainintmain(void){ const char *path = "/usr/share/dict/words"; struct stat sb; dispatch_test_start("Dispatch Source Read"); int infd = open(path, O_RDONLY); if (infd == -1) { perror(path); exit(EXIT_FAILURE); } if (fstat(infd, &sb) == -1) { perror(path); exit(EXIT_FAILURE); } bytes_total = sb.st_size; if (fcntl(infd, F_SETFL, O_NONBLOCK) != 0) { perror(path); exit(EXIT_FAILURE); } if (!dispatch_test_check_evfilt_read_for_fd(infd)) { test_skip("EVFILT_READ kevent not firing for test file"); test_fin(NULL); } dispatch_queue_t main_q = dispatch_get_main_queue(); test_ptr_notnull("dispatch_get_main_queue", main_q); dispatch_source_t reader = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, infd, 0, main_q); test_ptr_notnull("dispatch_source_create", reader); assert(reader); dispatch_source_set_event_handler(reader, ^{ size_t estimated = dispatch_source_get_data(reader); fprintf(stderr, "bytes available: %zu/n", estimated); test_double_less_than_or_equal("estimated", estimated, bytes_total - bytes_read); const ssize_t bufsiz = 1024*500; // 500 KB buffer static char buffer[1024*500]; // 500 KB buffer ssize_t actual = read(infd, buffer, sizeof(buffer)); bytes_read += actual; printf("bytes read: %zd/n", actual); if (actual < bufsiz) { actual = read(infd, buffer, sizeof(buffer)); bytes_read += actual; // confirm EOF condition test_long("EOF", actual, 0); dispatch_source_cancel(reader); } });
开发者ID:2php,项目名称:libdispatch,代码行数:53,
示例15: mainintmain(void){ dispatch_test_start("Dispatch VM Pressure test"); // rdar://problem/7000945 if (!dispatch_test_check_evfilt_vm()) { test_skip("EVFILT_VM not supported"); test_stop(); return 0; } initial = time(NULL); uint64_t memsize = _dispatch_get_memory_size(); max_page_count = MIN(memsize, MAXMEM) / ALLOC_SIZE; pages = calloc(max_page_count, sizeof(char*)); vm_queue = dispatch_queue_create("VM Pressure", NULL); vm_source = dispatch_source_create(DISPATCH_SOURCE_TYPE_VM, 0, DISPATCH_VM_PRESSURE, vm_queue); dispatch_source_set_event_handler(vm_source, ^{ if (!page_count) { // Too much memory pressure already to start the test test_skip("Memory pressure at start of test"); cleanup(); } if (__sync_add_and_fetch(&handler_call_count, 1) != NOTIFICATIONS) { log_msg("Ignoring vm pressure notification/n"); interval = 1; return; } test_long("dispatch_source_get_data()", dispatch_source_get_data(vm_source), NOTE_VM_PRESSURE); int32_t i, pc = page_count + 1; for (i = 0; i < pc && pages[i]; ++i) { free(pages[i]); pages[i] = NULL; } log_msg("Freed %ldMB/n", pg2mb(i)); });
开发者ID:PSPDFKit-labs,项目名称:libdispatch,代码行数:37,
示例16: mainint main(int argc, char **argv) { int events[1]; long long counts[1]; int retval,quiet; char test_string[]="Testing PAPI_SYC_INS predefined event..."; quiet=test_quiet(); retval = PAPI_library_init(PAPI_VER_CURRENT); if (retval != PAPI_VER_CURRENT) { if (!quiet) printf("Error! PAPI_library_init %d/n",retval); test_fail(test_string); } retval = PAPI_query_event(PAPI_SYC_INS); if (retval != PAPI_OK) { if (!quiet) printf("PAPI_SYC_INS not available/n"); test_skip(test_string); } events[0]=PAPI_SYC_INS; PAPI_start_counters(events,1); PAPI_stop_counters(counts,1); if (counts[0]<1) { if (!quiet) printf("Error! Count too low/n"); test_fail(test_string); } PAPI_shutdown(); test_unimplemented(test_string); return 0;}
开发者ID:Johnrosh,项目名称:perf_event_tests,代码行数:40,
示例17: test_harnessint test_harness(int (test_function)(void), char *name){ int rc; test_start(name); test_set_git_version(GIT_VERSION); if (sigaction(SIGALRM, &alarm_action, NULL)) { perror("sigaction"); test_error(name); return 1; } rc = run_test(test_function, name); if (rc == MAGIC_SKIP_RETURN_VALUE) test_skip(name); else test_finish(name, rc); return rc;}
开发者ID:383530895,项目名称:linux,代码行数:22,
示例18: mainint main(void) { CRYPTO_library_init(); if (!test_skip() || !test_get_u() || !test_get_prefixed() || !test_get_prefixed_bad() || !test_get_asn1() || !test_cbb_basic() || !test_cbb_fixed() || !test_cbb_finish_child() || !test_cbb_misuse() || !test_cbb_prefixed() || !test_cbb_asn1() || !test_ber_convert() || !test_asn1_uint64() || !test_get_optional_asn1_bool()) { return 1; } printf("PASS/n"); return 0;}
开发者ID:HungMingWu,项目名称:libquic,代码行数:23,
示例19: mainintmain( int argc, char **argv ){ int EventSet = PAPI_NULL; long long values0[2],values1[2],values2[2]; int num_flops = 3000000, retval; int mythreshold = 1000000; char event_name1[PAPI_MAX_STR_LEN]; int PAPI_event; int cid,numcmp,rapl_cid; const PAPI_component_info_t *cmpinfo = NULL; /* Set TESTS_QUIET variable */ tests_quiet( argc, argv ); quiet=TESTS_QUIET; /* Init PAPI */ retval = PAPI_library_init( PAPI_VER_CURRENT ); if ( retval != PAPI_VER_CURRENT ) { test_fail(__FILE__, __LINE__,"PAPI_library_init",retval); } numcmp = PAPI_num_components(); for(cid=0; cid<numcmp; cid++) { if ( (cmpinfo = PAPI_get_component_info(cid)) == NULL) { test_fail(__FILE__, __LINE__,"PAPI_get_component_info failed/n", 0); } if (strstr(cmpinfo->name,"linux-rapl")) { rapl_cid=cid; if (!TESTS_QUIET) printf("Found rapl component at cid %d/n", rapl_cid); if (cmpinfo->num_native_events==0) { test_skip(__FILE__,__LINE__,"No rapl events found",0); } break; } } /* Component not found */ if (cid==numcmp) { test_skip(__FILE__,__LINE__,"No rapl component found/n",0); } /* add PAPI_TOT_CYC and PAPI_TOT_INS */ retval=PAPI_create_eventset(&EventSet); if ( retval != PAPI_OK ) { test_fail(__FILE__, __LINE__,"PAPI_create_eventset",retval); } retval=PAPI_add_event(EventSet,PAPI_TOT_CYC); if ( retval != PAPI_OK ) { test_fail(__FILE__, __LINE__,"PAPI_add_event",retval); } retval=PAPI_add_event(EventSet,PAPI_TOT_INS); if ( retval != PAPI_OK ) { test_fail(__FILE__, __LINE__,"PAPI_add_event",retval); } /* Add some RAPL events */ retval=PAPI_create_eventset(&EventSet2); if ( retval != PAPI_OK ) { test_fail(__FILE__, __LINE__,"PAPI_create_eventset",retval); } retval=PAPI_add_named_event(EventSet2,"PACKAGE_ENERGY:PACKAGE0"); if ( retval != PAPI_OK ) { test_fail(__FILE__, __LINE__,"PAPI_add_event",retval); } retval=PAPI_add_named_event(EventSet2,"PACKAGE_ENERGY:PACKAGE1"); if ( retval != PAPI_OK ) { test_fail(__FILE__, __LINE__,"PAPI_add_event",retval); } PAPI_event=PAPI_TOT_CYC; /* arbitrary */ mythreshold = 2000000; if (!TESTS_QUIET) { printf("Using %x for the overflow event, threshold %d/n", PAPI_event,mythreshold); } /* Start the run calibration run */ retval = PAPI_start( EventSet ); if ( retval != PAPI_OK ) { test_fail(__FILE__, __LINE__,"PAPI_start",retval); } do_ints(num_flops,TESTS_QUIET); do_flops( 3000000 ); /* stop the calibration run */ retval = PAPI_stop( EventSet, values0 );//.........这里部分代码省略.........
开发者ID:pyrovski,项目名称:papi-rapl,代码行数:101,
示例20: main//.........这里部分代码省略......... retval = PAPI_library_init( PAPI_VER_CURRENT ); if ( retval != PAPI_VER_CURRENT ) { test_fail(__FILE__, __LINE__,"PAPI_library_init failed/n",retval); } if (!TESTS_QUIET) { printf("Trying all net events/n"); } numcmp = PAPI_num_components(); for(cid=0; cid<numcmp; cid++) { if ( (cmpinfo = PAPI_get_component_info(cid)) == NULL) { test_fail(__FILE__, __LINE__,"PAPI_get_component_info failed/n",-1); } if (!TESTS_QUIET) { printf("Component %d - %d events - %s/n", cid, cmpinfo->num_native_events, cmpinfo->name); } if ( strstr(cmpinfo->name, "infiniband") == NULL) { continue; } code = PAPI_NATIVE_MASK; r = PAPI_enum_cmp_event( &code, PAPI_ENUM_FIRST, cid ); while ( r == PAPI_OK ) { retval = PAPI_event_code_to_name( code, event_name ); if ( retval != PAPI_OK ) { test_fail( __FILE__, __LINE__, "PAPI_event_code_to_name", retval ); } if (!TESTS_QUIET) { printf("%#x %-24s = ", code, event_name); } EventSet = PAPI_NULL; retval = PAPI_create_eventset( &EventSet ); if (retval != PAPI_OK) { test_fail(__FILE__, __LINE__, "PAPI_create_eventset()", retval); } retval = PAPI_add_event( EventSet, code ); if (retval != PAPI_OK) { test_fail(__FILE__, __LINE__, "PAPI_add_event()", retval); } retval = PAPI_start( EventSet ); if (retval != PAPI_OK) { test_fail(__FILE__, __LINE__, "PAPI_start()", retval); } if (strcmp(event_name, "_recv") == 0) { /* XXX figure out a general method to generate some traffic * for infiniband * the operation should take more than one second in order * to guarantee that the network counters are updated */ retval = system("ping -c 4 " PINGADDR " > /dev/null"); if (retval < 0) { test_fail(__FILE__, __LINE__, "Unable to start ping", retval); } } retval = PAPI_stop( EventSet, &value ); if (retval != PAPI_OK) { test_fail(__FILE__, __LINE__, "PAPI_stop()", retval); } if (!TESTS_QUIET) printf("%lld/n", value); retval = PAPI_cleanup_eventset( EventSet ); if (retval != PAPI_OK) { test_fail(__FILE__, __LINE__, "PAPI_cleanup_eventset()", retval); } retval = PAPI_destroy_eventset( &EventSet ); if (retval != PAPI_OK) { test_fail(__FILE__, __LINE__, "PAPI_destroy_eventset()", retval); } total_events++; r = PAPI_enum_cmp_event( &code, PAPI_ENUM_EVENTS, cid ); } } if (total_events==0) { test_skip(__FILE__,__LINE__,"No net events found", 0); } test_pass( __FILE__, NULL, 0 ); return 0;}
开发者ID:DanieleDeSensi,项目名称:mammut,代码行数:101,
示例21: mainint main (int argc, char **argv){ int retval,cid,rapl_cid=-1,numcmp; int EventSet = PAPI_NULL; long long *values; int num_events=0; int code; char event_names[MAX_RAPL_EVENTS][PAPI_MAX_STR_LEN]; char units[MAX_RAPL_EVENTS][PAPI_MIN_STR_LEN]; int r,i; const PAPI_component_info_t *cmpinfo = NULL; PAPI_event_info_t evinfo; long long before_time,after_time; double elapsed_time; /* Set TESTS_QUIET variable */ tests_quiet( argc, argv ); /* PAPI Initialization */ retval = PAPI_library_init( PAPI_VER_CURRENT ); if ( retval != PAPI_VER_CURRENT ) { test_fail(__FILE__, __LINE__,"PAPI_library_init failed/n",retval); } if (!TESTS_QUIET) { printf("Trying all RAPL events/n"); } numcmp = PAPI_num_components(); for(cid=0; cid<numcmp; cid++) { if ( (cmpinfo = PAPI_get_component_info(cid)) == NULL) { test_fail(__FILE__, __LINE__,"PAPI_get_component_info failed/n", 0); } if (strstr(cmpinfo->name,"rapl")) { rapl_cid=cid; if (!TESTS_QUIET) { printf("Found rapl component at cid %d/n",rapl_cid); } if (cmpinfo->disabled) { if (!TESTS_QUIET) { printf("RAPL component disabled: %s/n", cmpinfo->disabled_reason); } test_skip(__FILE__,__LINE__,"RAPL component disabled",0); } break; } } /* Component not found */ if (cid==numcmp) { test_skip(__FILE__,__LINE__,"No rapl component found/n",0); } /* Create EventSet */ retval = PAPI_create_eventset( &EventSet ); if (retval != PAPI_OK) { test_fail(__FILE__, __LINE__, "PAPI_create_eventset()",retval); } /* Add all events */ code = PAPI_NATIVE_MASK; r = PAPI_enum_cmp_event( &code, PAPI_ENUM_FIRST, rapl_cid ); while ( r == PAPI_OK ) { retval = PAPI_event_code_to_name( code, event_names[num_events] ); if ( retval != PAPI_OK ) { printf("Error translating %#x/n",code); test_fail( __FILE__, __LINE__, "PAPI_event_code_to_name", retval ); } retval = PAPI_get_event_info(code,&evinfo); if (retval != PAPI_OK) { test_fail( __FILE__, __LINE__, "Error getting event info/n",retval); } strncpy(units[num_events],evinfo.units,PAPI_MIN_STR_LEN); retval = PAPI_add_event( EventSet, code ); if (retval != PAPI_OK) { break; /* We've hit an event limit */ } num_events++; r = PAPI_enum_cmp_event( &code, PAPI_ENUM_EVENTS, rapl_cid ); }//.........这里部分代码省略.........
开发者ID:FMCalisto,项目名称:SMP,代码行数:101,
示例22: mainint main(int argc, char **argv) { int events[MAX_TEST_EVENTS]; int fd[MAX_TEST_EVENTS]; int count=MAX_TEST_EVENTS; int i,j,n; int ret1,ret2,ret3; struct perf_event_attr pe; int quiet,nmi_enabled; char test_string[]="Testing if we can determine maximum events despite NMI watchdog..."; quiet=test_quiet(); if (!quiet) { printf("If the NMI watchdog is enabled it will steal a performance/n"); printf(" counter. There is a bug that if you try to use the/n"); printf(" maximum number of counters anyway, sys_perf_open()/n"); printf(" will succede but will fail when you try to read()/n"); printf(" the values./n/n"); } nmi_enabled=detect_nmi_watchdog(); if (!nmi_enabled) { if (!quiet) { printf("No NMI watchdog detected, so skipping test./n/n"); } test_skip(test_string); } if (copy_events(events)) { test_unimplemented(test_string); } for(i=1;i<count;i++) { if (!quiet) printf("Trying %d events:/n",i); memset(&pe,0,sizeof(struct perf_event_attr)); pe.type=PERF_TYPE_RAW; pe.size=sizeof(struct perf_event_attr); pe.read_format=PERF_FORMAT_GROUP|PERF_FORMAT_ID; fd[0]=-1; for(j=0;j<i;j++) { pe.config=events[j]; if (j==0) { pe.disabled=1; pe.pinned=1; } else { pe.disabled=0; pe.pinned=0; } fd[j]=perf_event_open(&pe,0,-1,fd[0],0); if (fd[j]<0) { if (!quiet) printf("Finished after event %d/n/n",j); test_pass(test_string); exit(1); } } /* start */ ret1=ioctl(fd[0], PERF_EVENT_IOC_ENABLE,0); /* stop */ ret2=ioctl(fd[0], PERF_EVENT_IOC_DISABLE,0); #define BUFFER_SIZE 256 long long buffer[BUFFER_SIZE]; ret3=read(fd[0],buffer,BUFFER_SIZE*sizeof(long long)); if (ret3<=0) { if (!quiet) { printf("Unexpected read result %d %s/n",ret3,strerror(errno)); } test_fail(test_string); } if (buffer[0]!=j){ if (!quiet) printf("Error! buffer count is %lld not %d!/n", buffer[0],j); test_fail(test_string); } if (ret1<0) { if (!quiet) printf("Error starting!/n"); test_fail(test_string); } if (ret2<0) {//.........这里部分代码省略.........
开发者ID:Johnrosh,项目名称:perf_event_tests,代码行数:101,
示例23: thd_startvoid *thd_start(void *arg){ int err; size_t sz; bool e0, e1; sz = sizeof(bool); if ((err = mallctl("thread.tcache.enabled", &e0, &sz, NULL, 0))) { if (err == ENOENT) { assert_false(config_tcache, "ENOENT should only be returned if tcache is " "disabled"); } goto label_ENOENT; } if (e0) { e1 = false; assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0, "Unexpected mallctl() error"); assert_true(e0, "tcache should be enabled"); } e1 = true; assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0, "Unexpected mallctl() error"); assert_false(e0, "tcache should be disabled"); e1 = true; assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0, "Unexpected mallctl() error"); assert_true(e0, "tcache should be enabled"); e1 = false; assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0, "Unexpected mallctl() error"); assert_true(e0, "tcache should be enabled"); e1 = false; assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0, "Unexpected mallctl() error"); assert_false(e0, "tcache should be disabled"); free(malloc(1)); e1 = true; assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0, "Unexpected mallctl() error"); assert_false(e0, "tcache should be disabled"); free(malloc(1)); e1 = true; assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0, "Unexpected mallctl() error"); assert_true(e0, "tcache should be enabled"); free(malloc(1)); e1 = false; assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0, "Unexpected mallctl() error"); assert_true(e0, "tcache should be enabled"); free(malloc(1)); e1 = false; assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0, "Unexpected mallctl() error"); assert_false(e0, "tcache should be disabled"); free(malloc(1)); return (NULL);label_ENOENT: test_skip("/"thread.tcache.enabled/" mallctl not available"); return (NULL);}
开发者ID:Hypebble,项目名称:oneroof,代码行数:74,
示例24: mainintmain( int argc, char *argv[] ){ extern void dummy( void * ); float aa, *a, *b, *c, *x, *y; double aad, *ad, *bd, *cd, *xd, *yd; int i, j, n; int inner = 0; int vector = 0; int matrix = 0; int double_precision = 0; int retval = PAPI_OK; char papi_event_str[PAPI_MIN_STR_LEN] = "PAPI_FP_OPS"; int papi_event; int EventSet = PAPI_NULL;/* Parse the input arguments */ for ( i = 0; i < argc; i++ ) { if ( strstr( argv[i], "-i" ) ) inner = 1; else if ( strstr( argv[i], "-v" ) ) vector = 1; else if ( strstr( argv[i], "-m" ) ) matrix = 1; else if ( strstr( argv[i], "-e" ) ) { if ( ( argv[i + 1] == NULL ) || ( strlen( argv[i + 1] ) == 0 ) ) { print_help( argv ); exit( 1 ); } strncpy( papi_event_str, argv[i + 1], sizeof ( papi_event_str ) ); i++; } else if ( strstr( argv[i], "-d" ) ) double_precision = 1; else if ( strstr( argv[i], "-h" ) ) { print_help( argv ); exit( 1 ); } } /* if no options specified, set all tests to TRUE */ if ( inner + vector + matrix == 0 ) inner = vector = matrix = 1; tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */ if ( !TESTS_QUIET ) printf( "Initializing..." ); /* Initialize PAPI */ retval = PAPI_library_init( PAPI_VER_CURRENT ); if ( retval != PAPI_VER_CURRENT ) test_fail( __FILE__, __LINE__, "PAPI_library_init", retval ); /* Translate name */ retval = PAPI_event_name_to_code( papi_event_str, &papi_event ); if ( retval != PAPI_OK ) test_fail( __FILE__, __LINE__, "PAPI_event_name_to_code", retval ); if ( PAPI_query_event( papi_event ) != PAPI_OK ) test_skip( __FILE__, __LINE__, "PAPI_query_event", PAPI_ENOEVNT ); if ( ( retval = PAPI_create_eventset( &EventSet ) ) != PAPI_OK ) test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval ); if ( ( retval = PAPI_add_event( EventSet, papi_event ) ) != PAPI_OK ) test_fail( __FILE__, __LINE__, "PAPI_add_event", retval ); printf( "/n" ); retval = PAPI_OK; /* Inner Product test */ if ( inner ) { /* Allocate the linear arrays */ if (double_precision) { xd = malloc( INDEX5 * sizeof(double) ); yd = malloc( INDEX5 * sizeof(double) ); if ( !( xd && yd ) ) retval = PAPI_ENOMEM; } else { x = malloc( INDEX5 * sizeof(float) ); y = malloc( INDEX5 * sizeof(float) ); if ( !( x && y ) ) retval = PAPI_ENOMEM; } if ( retval == PAPI_OK ) { headerlines( "Inner Product Test", TESTS_QUIET ); /* step through the different array sizes */ for ( n = 0; n < INDEX5; n++ ) { if ( n < INDEX1 || ( ( n + 1 ) % 50 ) == 0 ) { /* Initialize the needed arrays at this size */ if ( double_precision ) { for ( i = 0; i <= n; i++ ) { xd[i] = ( double ) rand( ) * ( double ) 1.1;//.........这里部分代码省略.........
开发者ID:naps62,项目名称:CPD_PAPI,代码行数:101,
示例25: mainintmain( int argc, char **argv ){ pthread_t id[NUM_THREADS]; int flops[NUM_THREADS]; int i, rc, retval; pthread_attr_t attr; long long elapsed_us, elapsed_cyc; const PAPI_exe_info_t *prginfo = NULL; 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 ( ( retval = PAPI_thread_init( ( unsigned long ( * )( void ) ) ( pthread_self ) ) ) != PAPI_OK ) { if ( retval == PAPI_ECMP ) test_skip( __FILE__, __LINE__, "PAPI_thread_init", retval ); else test_fail( __FILE__, __LINE__, "PAPI_thread_init", retval ); } if ( ( prginfo = PAPI_get_executable_info( ) ) == NULL ) { retval = 1; test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", retval ); } my_start = prginfo->address_info.text_start; my_end = prginfo->address_info.text_end; length = ( unsigned int ) ( my_end - my_start ); elapsed_us = PAPI_get_real_usec( ); elapsed_cyc = PAPI_get_real_cyc( ); pthread_attr_init( &attr );#ifdef PTHREAD_CREATE_UNDETACHED pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_UNDETACHED );#endif#ifdef PTHREAD_SCOPE_SYSTEM retval = pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM ); if ( retval != 0 ) test_skip( __FILE__, __LINE__, "pthread_attr_setscope", retval );#endif for ( i = 0; i < NUM_THREADS; i++ ) { flops[i] = FLOPS * ( i + 1 ); rc = pthread_create( &id[i], &attr, Thread, ( void * ) &flops[i] ); if ( rc ) return ( FAILURE ); } for ( i = 0; i < NUM_THREADS; i++ ) pthread_join( id[i], NULL ); pthread_attr_destroy( &attr ); elapsed_cyc = PAPI_get_real_cyc( ) - elapsed_cyc; elapsed_us = PAPI_get_real_usec( ) - elapsed_us; if ( !TESTS_QUIET ) { printf( "Master real usec : /t%lld/n", elapsed_us ); printf( "Master real cycles : /t%lld/n", elapsed_cyc ); } test_pass( __FILE__, NULL, 0 ); pthread_exit( NULL ); exit( 1 );}
开发者ID:drahoslavzan,项目名称:MKP-PSO,代码行数:70,
示例26: mainint main (int argc, char **argv){ int retval,cid,numcmp; int EventSet = PAPI_NULL; long long values[NUM_EVENTS]; int code; char event_name[PAPI_MAX_STR_LEN]; int total_events=0; int r; const PAPI_component_info_t *cmpinfo = NULL; /* Set TESTS_QUIET variable */ tests_quiet( argc, argv ); /* PAPI Initialization */ retval = PAPI_library_init( PAPI_VER_CURRENT ); if ( retval != PAPI_VER_CURRENT ) { test_fail(__FILE__, __LINE__,"PAPI_library_init failed/n",retval); } numcmp = PAPI_num_components(); for(cid=0; cid<numcmp; cid++) { if (!TESTS_QUIET) { if ( (cmpinfo = PAPI_get_component_info(cid)) == NULL) { test_fail(__FILE__, __LINE__,"PAPI_get_component_info failed/n", 0); } printf("/tComponent %d - %s/n", cid, cmpinfo->name); } code = PAPI_NATIVE_MASK; r = PAPI_enum_cmp_event( &code, PAPI_ENUM_FIRST, cid ); while ( r == PAPI_OK ) { retval = PAPI_event_code_to_name( code, event_name ); if ( retval != PAPI_OK ) { printf("Error translating %x/n",code); test_fail( __FILE__, __LINE__, "PAPI_event_code_to_name", retval ); } if (!strncmp(event_name,"micpower",8)) { if (!TESTS_QUIET) printf("0x%x %s ",code,event_name); EventSet = PAPI_NULL; retval = PAPI_create_eventset( &EventSet ); if (retval != PAPI_OK) { test_fail(__FILE__, __LINE__, "PAPI_create_eventset()",retval); } retval = PAPI_add_event( EventSet, code ); if (retval != PAPI_OK) { test_fail(__FILE__, __LINE__, "PAPI_add_event()",retval); } retval = PAPI_start( EventSet); if (retval != PAPI_OK) { test_fail(__FILE__, __LINE__, "PAPI_start()",retval); } retval = PAPI_stop( EventSet, values); if (retval != PAPI_OK) { test_fail(__FILE__, __LINE__, "PAPI_start()",retval); } if (!TESTS_QUIET) printf(" value: %lld/n",values[0]); retval = PAPI_cleanup_eventset( EventSet ); if (retval != PAPI_OK) { test_fail(__FILE__, __LINE__, "PAPI_cleanup_eventset()",retval); } retval = PAPI_destroy_eventset( &EventSet ); if (retval != PAPI_OK) { test_fail(__FILE__, __LINE__, "PAPI_destroy_eventset()",retval); } total_events++; } r = PAPI_enum_cmp_event( &code, PAPI_ENUM_EVENTS, cid ); } } if (total_events==0) { test_skip(__FILE__,__LINE__,"No coretemp events found",0); } test_pass( __FILE__, NULL, 0 ); return 0;}
开发者ID:drahoslavzan,项目名称:MKP-PSO,代码行数:100,
示例27: mainint main(int argc, char** argv) { int fd1,i; struct perf_event_attr pe1; int errors=0; int result; char test_string[]="Testing PERF_EVENT_IOC_SET_FILTER ioctl..."; quiet=test_quiet(); if (!quiet) { printf("Testing PERF_EVENT_IOC_SET_FILTER ioctl./n"); } /****************************************************/ /* Check if /sys/kernel/debug/tracing/events exists */ /****************************************************/// result=access("/sys/kernel/debug/tracing/events",F_OK); /* Actually this is pointless, as it gives EACCESS */ /* as a normal user even if the file exists */ /************************************/ /* Creating a tracepoint event */ /************************************/ if (!quiet) { printf("Creating a tracepoint event/n"); } memset(&pe1,0,sizeof(struct perf_event_attr)); pe1.type=PERF_TYPE_TRACEPOINT; pe1.size=sizeof(struct perf_event_attr); /* Find a trace event that will let us add a particular filter */ /* It should work with */ /* writeback:writeback_start*/ /* but we can't get the id of this directly without debugfs/tracefs */ /* mounted (the id numbers change depending on machine/kernel) */ /* Valid filter */ strcpy(filter,"nr_pages==2"); if (!quiet) { printf("Trying to find an event that will allow filter %s/n", filter); } /* Usually there are fewer than 1000 trace events? */ for(i=0;i<MAX_SEARCH;i++) { pe1.config=i; pe1.disabled=1; pe1.exclude_kernel=0; pe1.exclude_hv=0; arch_adjust_domain(&pe1,quiet); fd1=perf_event_open(&pe1,0,-1,-1,0); if (fd1<0) { if (!quiet) { // fprintf(stderr,"Failed on %d/n",i); } continue; } result=ioctl(fd1, PERF_EVENT_IOC_SET_FILTER, filter); if (result==0) { if (!quiet) printf("Found proper event %d/n",i); close(fd1); break; } else { } close(fd1); } if (i==MAX_SEARCH) { if (!quiet) { printf("Could not find any trace event to filter/n"); } test_skip(test_string); errors++; } pe1.config=i; pe1.disabled=1; pe1.exclude_kernel=0; pe1.exclude_hv=0; arch_adjust_domain(&pe1,quiet); /* Create group leader */ fd1=perf_event_open(&pe1,0,-1,-1,0); if (fd1<0) { if (!quiet) { fprintf(stderr,"Unexpected error %s/n",strerror(errno)); }//.........这里部分代码省略.........
开发者ID:deater,项目名称:perf_event_tests,代码行数:101,
示例28: mainintmain( int argc, char **argv ){ int status, retval, num_tests = 1, tmp; int EventSet1 = PAPI_NULL; long long **values; long long elapsed_us, elapsed_cyc, elapsed_virt_us, elapsed_virt_cyc; char event_name[PAPI_MAX_STR_LEN];; const PAPI_hw_info_t *hw_info; const PAPI_component_info_t *cmpinfo; pid_t pid; /* Fork before doing anything with the PMU */ setbuf(stdout,NULL); 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 */ /* Master only process below here */ retval = PAPI_library_init( PAPI_VER_CURRENT ); if ( retval != PAPI_VER_CURRENT ) test_fail_exit( __FILE__, __LINE__, "PAPI_library_init", retval ); if ( ( cmpinfo = PAPI_get_component_info( 0 ) ) == NULL ) test_fail_exit( __FILE__, __LINE__, "PAPI_get_component_info", 0 ); if ( cmpinfo->attach == 0 ) test_skip( __FILE__, __LINE__, "Platform does not support attaching", 0 ); hw_info = PAPI_get_hardware_info( ); if ( hw_info == NULL ) test_fail_exit( __FILE__, __LINE__, "PAPI_get_hardware_info", 0 ); /* add PAPI_TOT_CYC and one of the events in PAPI_FP_INS, PAPI_FP_OPS or PAPI_TOT_INS, depending on the availability of the event on the platform */ retval = PAPI_create_eventset(&EventSet1); if ( retval != PAPI_OK ) test_fail_exit( __FILE__, __LINE__, "PAPI_attach", retval ); /* Force addition of component */ retval = PAPI_assign_eventset_component( EventSet1, 0 ); if ( retval != PAPI_OK ) test_fail( __FILE__, __LINE__, "PAPI_assign_eventset_component", retval ); /* The following call causes this test to fail for perf_events */ retval = PAPI_attach( EventSet1, ( unsigned long ) pid ); if ( retval != PAPI_OK ) test_fail_exit( __FILE__, __LINE__, "PAPI_attach", retval ); sprintf(event_name,"PAPI_TOT_CYC"); retval = PAPI_add_event(EventSet1, PAPI_TOT_CYC); if ( retval != PAPI_OK ) test_fail_exit( __FILE__, __LINE__, "PAPI_add_event", retval ); retval = PAPI_add_event(EventSet1, PAPI_FP_INS); if ( retval == PAPI_ENOEVNT ) { test_warn( __FILE__, __LINE__, "PAPI_FP_INS", retval); } else if ( retval != PAPI_OK ) { test_fail_exit( __FILE__, __LINE__, "PAPI_add_event", retval ); } values = allocate_test_space( 1, 2); elapsed_us = PAPI_get_real_usec( ); elapsed_cyc = PAPI_get_real_cyc( ); elapsed_virt_us = PAPI_get_virt_usec( ); elapsed_virt_cyc = PAPI_get_virt_cyc( ); printf("must_ptrace is %d/n",cmpinfo->attach_must_ptrace); pid_t child = wait( &status ); printf( "Debugger exited wait() with %d/n",child ); if (WIFSTOPPED( status )) { printf( "Child has stopped due to signal %d (%s)/n", WSTOPSIG( status ), strsignal(WSTOPSIG( status )) ); } if (WIFSIGNALED( status )) { printf( "Child %ld received signal %d (%s)/n", (long)child, WTERMSIG(status) , strsignal(WTERMSIG( status )) ); } printf("After %d/n",retval); retval = PAPI_start( EventSet1 );//.........这里部分代码省略.........
开发者ID:jtombiamba,项目名称:MABTools,代码行数:101,
示例29: threadvoid *thread( void *arg ){ ( void ) arg; /*unused */ int eventset = PAPI_NULL; long long values[PAPI_MPX_DEF_DEG]; int ret = PAPI_register_thread( ); if ( ret != PAPI_OK ) test_fail( __FILE__, __LINE__, "PAPI_register_thread", ret ); ret = PAPI_create_eventset( &eventset ); if ( ret != PAPI_OK ) test_fail( __FILE__, __LINE__, "PAPI_create_eventset", ret ); printf( "Event set %d created/n", eventset ); /* In Component PAPI, EventSets must be assigned a component index before you can fiddle with their internals. 0 is always the cpu component */ ret = PAPI_assign_eventset_component( eventset, 0 ); if ( ret != PAPI_OK ) { test_fail( __FILE__, __LINE__, "PAPI_assign_eventset_component", ret ); } ret = PAPI_set_multiplex( eventset ); if ( ret == PAPI_ENOSUPP) { test_skip( __FILE__, __LINE__, "Multiplexing not supported", 1 ); } else if ( ret != PAPI_OK ) { test_fail( __FILE__, __LINE__, "PAPI_set_multiplex", ret ); } ret = PAPI_add_events( eventset, events, numevents ); if ( ret < PAPI_OK ) { test_fail( __FILE__, __LINE__, "PAPI_add_events", ret ); } ret = PAPI_start( eventset ); if ( ret != PAPI_OK ) { test_fail( __FILE__, __LINE__, "PAPI_start", ret ); } do_stuff( ); ret = PAPI_stop( eventset, values ); if ( ret != PAPI_OK ) { test_fail( __FILE__, __LINE__, "PAPI_stop", ret ); } ret = PAPI_cleanup_eventset( eventset ); if ( ret != PAPI_OK ) { test_fail( __FILE__, __LINE__, "PAPI_cleanup_eventset", ret ); } ret = PAPI_destroy_eventset( &eventset ); if ( ret != PAPI_OK ) { test_fail( __FILE__, __LINE__, "PAPI_destroy_eventset", ret ); } ret = PAPI_unregister_thread( ); if ( ret != PAPI_OK ) test_fail( __FILE__, __LINE__, "PAPI_unregister_thread", ret ); return ( NULL );}
开发者ID:pyrovski,项目名称:papi-rapl,代码行数:64,
示例30: mainintmain( int argc, char **argv ){ pthread_t e_th, f_th, g_th, h_th; int flops1, flops2, flops3, flops4, flops5; int retval, rc; pthread_attr_t attr; 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 ); retval = PAPI_thread_init( ( unsigned long ( * )( void ) ) ( pthread_self ) ); if ( retval != PAPI_OK ) { if ( retval == PAPI_ECMP ) test_skip( __FILE__, __LINE__, "PAPI_thread_init", retval ); else test_fail( __FILE__, __LINE__, "PAPI_thread_init", retval ); } pthread_attr_init( &attr );#ifdef PTHREAD_CREATE_UNDETACHED pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_UNDETACHED );#endif#ifdef PTHREAD_SCOPE_SYSTEM retval = pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM ); if ( retval != 0 ) test_skip( __FILE__, __LINE__, "pthread_attr_setscope", retval );#endif flops1 = 1000000; rc = pthread_create( &e_th, &attr, Thread, ( void * ) &flops1 ); if ( rc ) { retval = PAPI_ESYS; test_fail( __FILE__, __LINE__, "pthread_create", retval ); } flops2 = 2000000; rc = pthread_create( &f_th, &attr, Thread, ( void * ) &flops2 ); if ( rc ) { retval = PAPI_ESYS; test_fail( __FILE__, __LINE__, "pthread_create", retval ); } flops3 = 4000000; rc = pthread_create( &g_th, &attr, Thread, ( void * ) &flops3 ); if ( rc ) { retval = PAPI_ESYS; test_fail( __FILE__, __LINE__, "pthread_create", retval ); } flops4 = 8000000; rc = pthread_create( &h_th, &attr, Thread, ( void * ) &flops4 ); if ( rc ) { retval = PAPI_ESYS; test_fail( __FILE__, __LINE__, "pthread_create", retval ); } pthread_attr_destroy( &attr ); flops5 = 500000; Thread( &flops5 ); pthread_join( h_th, NULL ); pthread_join( g_th, NULL ); pthread_join( f_th, NULL ); pthread_join( e_th, NULL ); test_pass( __FILE__, NULL, 0 ); pthread_exit( NULL ); exit( 1 );}
开发者ID:FMCalisto,项目名称:SMP,代码行数:72,
注:本文中的test_skip函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ test_socket函数代码示例 C++ test_setup函数代码示例 |