void fractFunc::draw_aa(float min_progress, float max_progress) { int w = im->Xres(); int h = im->Yres(); reset_counts(); float delta = (max_progress - min_progress)/2.0; // if we have multiple threads, make sure they don't modify // pixels the other thread will look at - that wouldn't be // an error per se but would make drawing nondeterministic, // which I'm trying to avoid // We do this by drawing every even line, then every odd one. for(int i = 0; i < 2 ; ++i) { set_progress_range( min_progress + delta * i, min_progress + delta * (i+1)); reset_progress(0.0); last_update_y = 0; for(int y = i; y < h ; y+= 2) { worker->row_aa(0,y,w); if(update_image(y)) { break; } } reset_progress(1.0); } stats_changed(); }
void fractFunc::draw( int rsize, int drawsize, float min_progress, float max_progress) { if(debug_flags & DEBUG_QUICK_TRACE) { printf("drawing: %d\n", render_type); } reset_counts(); // init RNG based on time before generating image time_t now; time(&now); srand((unsigned int)now); int x,y; int w = im->Xres(); int h = im->Yres(); /* reset progress indicator & clear screen */ last_update_y = 0; reset_progress(min_progress); float mid_progress = (max_progress + min_progress)/2.0; set_progress_range(min_progress, mid_progress); // first pass - big blocks and edges for (y = 0 ; y < h - rsize ; y += rsize) { // main large blocks for ( x = 0 ; x< w - rsize ; x += rsize) { worker->pixel ( x, y, drawsize, drawsize); } // extra pixels at end of lines for(int y2 = y; y2 < y + rsize; ++y2) { worker->row (x, y2, w-x); } if(update_image(y)) { goto done; } } // remaining lines for ( ; y < h ; y++) { worker->row(0,y,w); if(update_image(y)) { goto done; } } last_update_y = 0; reset_progress(0.0); set_progress_range(mid_progress, max_progress); // fill in gaps in the rsize-blocks for ( y = 0; y < h - rsize; y += rsize) { for(x = 0; x < w - rsize ; x += rsize) { worker->box(x,y,rsize); } if(update_image(y)) { goto done; } } done: /* refresh entire image & reset progress bar */ reset_progress(1.0); }
void SnortEventqReset(void) { sfeventq_reset(getEventQueue()); reset_counts(); }
void SnortEventqResetCounts (void) { reset_counts(); }
static int trace_selftest_ops(struct trace_array *tr, int cnt) { int save_ftrace_enabled = ftrace_enabled; struct ftrace_ops *dyn_ops; char *func1_name; char *func2_name; int len1; int len2; int ret = -1; printk(KERN_CONT "PASSED\n"); pr_info("Testing dynamic ftrace ops #%d: ", cnt); ftrace_enabled = 1; reset_counts(); /* Handle PPC64 '.' name */ func1_name = "*" __stringify(DYN_FTRACE_TEST_NAME); func2_name = "*" __stringify(DYN_FTRACE_TEST_NAME2); len1 = strlen(func1_name); len2 = strlen(func2_name); /* * Probe 1 will trace function 1. * Probe 2 will trace function 2. * Probe 3 will trace functions 1 and 2. */ ftrace_set_filter(&test_probe1, func1_name, len1, 1); ftrace_set_filter(&test_probe2, func2_name, len2, 1); ftrace_set_filter(&test_probe3, func1_name, len1, 1); ftrace_set_filter(&test_probe3, func2_name, len2, 0); register_ftrace_function(&test_probe1); register_ftrace_function(&test_probe2); register_ftrace_function(&test_probe3); /* First time we are running with main function */ if (cnt > 1) { ftrace_init_array_ops(tr, trace_selftest_test_global_func); register_ftrace_function(tr->ops); } DYN_FTRACE_TEST_NAME(); print_counts(); if (trace_selftest_test_probe1_cnt != 1) goto out; if (trace_selftest_test_probe2_cnt != 0) goto out; if (trace_selftest_test_probe3_cnt != 1) goto out; if (cnt > 1) { if (trace_selftest_test_global_cnt == 0) goto out; } DYN_FTRACE_TEST_NAME2(); print_counts(); if (trace_selftest_test_probe1_cnt != 1) goto out; if (trace_selftest_test_probe2_cnt != 1) goto out; if (trace_selftest_test_probe3_cnt != 2) goto out; /* Add a dynamic probe */ dyn_ops = kzalloc(sizeof(*dyn_ops), GFP_KERNEL); if (!dyn_ops) { printk("MEMORY ERROR "); goto out; } dyn_ops->func = trace_selftest_test_dyn_func; register_ftrace_function(dyn_ops); trace_selftest_test_global_cnt = 0; DYN_FTRACE_TEST_NAME(); print_counts(); if (trace_selftest_test_probe1_cnt != 2) goto out_free; if (trace_selftest_test_probe2_cnt != 1) goto out_free; if (trace_selftest_test_probe3_cnt != 3) goto out_free; if (cnt > 1) { if (trace_selftest_test_global_cnt == 0) goto out_free; } if (trace_selftest_test_dyn_cnt == 0) goto out_free; DYN_FTRACE_TEST_NAME2(); print_counts(); if (trace_selftest_test_probe1_cnt != 2) goto out_free; if (trace_selftest_test_probe2_cnt != 2) goto out_free; if (trace_selftest_test_probe3_cnt != 4) goto out_free; ret = 0; out_free: unregister_ftrace_function(dyn_ops); kfree(dyn_ops); out: /* Purposely unregister in the same order */ unregister_ftrace_function(&test_probe1); unregister_ftrace_function(&test_probe2); unregister_ftrace_function(&test_probe3); if (cnt > 1) unregister_ftrace_function(tr->ops); ftrace_reset_array_ops(tr); /* Make sure everything is off */ reset_counts(); DYN_FTRACE_TEST_NAME(); DYN_FTRACE_TEST_NAME(); if (trace_selftest_test_probe1_cnt || trace_selftest_test_probe2_cnt || trace_selftest_test_probe3_cnt || trace_selftest_test_global_cnt || trace_selftest_test_dyn_cnt) ret = -1; ftrace_enabled = save_ftrace_enabled; return ret; }
int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Compiler_Features_10_Test")); try { // ... start the test fresh ... reset_counts(); // Let's try to build a simple object and destroy it, without any // exceptions raised ... May_Pop m1(false); // ... two instances of the base class should be created ... check_constructor_count(2, __FILE__, __LINE__); // ... but only one instance is destroyed at this point ... check_destructor_count(1, __FILE__, __LINE__); } catch (...) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error: Unexpected exception caught\n"))); } // ... now both instances are gone ... check_destructor_count(2, __FILE__, __LINE__); try { // ... start the test fresh ... reset_counts(); // ... now raise an exception ... May_Pop m1(true); never_reached(__FILE__, __LINE__); } catch(...) { // ... only one instance gets created ... check_constructor_count(1, __FILE__, __LINE__); // ... and it is gone ... check_destructor_count(1, __FILE__, __LINE__); } try { // ... start the test fresh ... reset_counts(); // ... now build a complex object with a failure in the middle ... Aggregate a; never_reached(__FILE__, __LINE__); } catch(...) { // ... check the expectations ... check_constructor_count(4, __FILE__, __LINE__); check_destructor_count(4, __FILE__, __LINE__); } try { // ... start the test fresh ... reset_counts(); std::auto_ptr<Aggregate> b(new Aggregate); never_reached(__FILE__, __LINE__); } catch(...) { // ... check the expectations ... check_constructor_count(4, __FILE__, __LINE__); check_destructor_count(4, __FILE__, __LINE__); check_alloc_count(1, __FILE__, __LINE__); } ACE_END_TEST; return status(); }
void SnortEventqReset(void) { sfeventq_reset(snort_conf->event_queue[qIndex]); reset_counts(); }
static int trace_selftest_ops(int cnt) { int save_ftrace_enabled = ftrace_enabled; struct ftrace_ops *dyn_ops; char *func1_name; char *func2_name; int len1; int len2; int ret = -1; printk(KERN_CONT "PASSED\n"); pr_info("Testing dynamic ftrace ops #%d: ", cnt); ftrace_enabled = 1; reset_counts(); /* */ func1_name = "*" __stringify(DYN_FTRACE_TEST_NAME); func2_name = "*" __stringify(DYN_FTRACE_TEST_NAME2); len1 = strlen(func1_name); len2 = strlen(func2_name); /* */ ftrace_set_filter(&test_probe1, func1_name, len1, 1); ftrace_set_filter(&test_probe2, func2_name, len2, 1); ftrace_set_filter(&test_probe3, func1_name, len1, 1); ftrace_set_filter(&test_probe3, func2_name, len2, 0); register_ftrace_function(&test_probe1); register_ftrace_function(&test_probe2); register_ftrace_function(&test_probe3); register_ftrace_function(&test_global); DYN_FTRACE_TEST_NAME(); print_counts(); if (trace_selftest_test_probe1_cnt != 1) goto out; if (trace_selftest_test_probe2_cnt != 0) goto out; if (trace_selftest_test_probe3_cnt != 1) goto out; if (trace_selftest_test_global_cnt == 0) goto out; DYN_FTRACE_TEST_NAME2(); print_counts(); if (trace_selftest_test_probe1_cnt != 1) goto out; if (trace_selftest_test_probe2_cnt != 1) goto out; if (trace_selftest_test_probe3_cnt != 2) goto out; /* */ dyn_ops = kzalloc(sizeof(*dyn_ops), GFP_KERNEL); if (!dyn_ops) { printk("MEMORY ERROR "); goto out; } dyn_ops->func = trace_selftest_test_dyn_func; register_ftrace_function(dyn_ops); trace_selftest_test_global_cnt = 0; DYN_FTRACE_TEST_NAME(); print_counts(); if (trace_selftest_test_probe1_cnt != 2) goto out_free; if (trace_selftest_test_probe2_cnt != 1) goto out_free; if (trace_selftest_test_probe3_cnt != 3) goto out_free; if (trace_selftest_test_global_cnt == 0) goto out; if (trace_selftest_test_dyn_cnt == 0) goto out_free; DYN_FTRACE_TEST_NAME2(); print_counts(); if (trace_selftest_test_probe1_cnt != 2) goto out_free; if (trace_selftest_test_probe2_cnt != 2) goto out_free; if (trace_selftest_test_probe3_cnt != 4) goto out_free; ret = 0; out_free: unregister_ftrace_function(dyn_ops); kfree(dyn_ops); out: /* */ unregister_ftrace_function(&test_probe1); unregister_ftrace_function(&test_probe2); unregister_ftrace_function(&test_probe3); unregister_ftrace_function(&test_global); /* */ reset_counts(); DYN_FTRACE_TEST_NAME(); DYN_FTRACE_TEST_NAME(); if (trace_selftest_test_probe1_cnt || trace_selftest_test_probe2_cnt || trace_selftest_test_probe3_cnt || trace_selftest_test_global_cnt || trace_selftest_test_dyn_cnt) ret = -1; ftrace_enabled = save_ftrace_enabled; return ret; }
MaxResults suboptSampler(Model B, PoSition **Pos, SimTime *S) { int **nNumMotifs, **startPos, /* startPos[MotifType][motifnum] */ i, j, seed_run = 0, t, k; int maxnum; /* maximum number of motif in one type motif */ register Mlist M; MaxResults maxData, locMax; RPType RP; IPtype IP; /* for quick access of input data */ PoSition *Pos_t; /* Pos_t=Pos[t] */ int n; /* BT 2/7/97 */ int nPos; int sum; double dCurrProb; #ifdef _MPI_ MPI_Status status; double dTempInfo[4]; #endif IP=B->IP; RP = B->RP; init_maxdata(&maxData); init_maxdata(&locMax); BeginTime(S); #ifdef _MPI_ if( ! IP->is_defined[cl_hm] ) { /* get the go ahead to start */ Gibbs_MPI_Recv( B, &dTempInfo, 4, MPI_DOUBLE, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status ); if( status.MPI_TAG == G_MPI_DONE ) return maxData; if( IP->is_defined[cl_X] && B->AN->bExchange ) { B->AN->currTemp = dTempInfo[0]; B->AN->dMinTemp = B->AN->currTemp; B->AN->dMaxTemp = B->AN->currTemp; PrintTempOut(IP->Datafiles->mpiTemp_fpt, "currTemp = %f maxTemp = %f minTemp = %f\n", B->AN->currTemp, B->AN->dMaxTemp, B->AN->dMinTemp ); } } #endif /* save the inital number of motifs */ for(t = 0; t < IP->nNumMotifTypes; t++) /* BT 2/7/97 */ { RP->nPriorMotifSites[t][FORWARD] = IP->nNumMotifs[t][FORWARD]; RP->nPriorMotifSites[t][REVERSE] = IP->nNumMotifs[t][REVERSE]; } /* copy the original counts into current counts */ copy_counts(B); nNumMotifs = copy_motif_num(IP); zero_motifs(IP); /* set motif count to zero */ /* If not running Wilcox test initialize random number gerator. */ /* Wilcox already did this */ if( ! IP->is_defined[cl_l] ) /* BT 7/23/97 */ sRandom(B, IP->lSeedVal); /* calculate the probability of NULL model */ /* IP->dnull_map = CalcMapProb(B, IP->is_defined[cl_R]); */ IP->dnull_map = CalcNullMap(B); /* 2/16/2001 */ reset_motif_num(nNumMotifs,IP); /* mark all possible motif sites */ if( ! IP->inCentroidAlign ) set_indicator_vector(Pos, B->Seq, B); maxnum = findMaxNumMotif(IP); if( IP->is_defined[cl_E] || RP->nUseSpacingProb || IP->is_defined[cl_T] ) /* BT 11/20/2000 */ { CountAlignments( B, Pos ); SaveAlignmentCounts( B ); } /* allocate space for start positions of motifs */ NEWP(startPos,IP->nNumMotifTypes, int); for(i = 0; i <IP->nNumMotifTypes ; i++) NEW(startPos[i],maxnum, int); /* Loop through for a number of different seeds */ while(seed_run++ < IP->nSeeds) { if( IP->is_defined[cl_X] ) { /* if( ! B->AN->bExchange ) B->AN->currTemp = B->AN->dMaxTemp; */ if( ! IP->is_defined[cl_Z] ) printf( "Current temperature: %7.2f\n", B->AN->currTemp ); } IP->nSeedRun = seed_run; if(!IP->is_defined[cl_F]) initMask(B); if( IP->is_defined[cl_X] ) init_maxdata( &(B->AN->results[seed_run]) ); /* initialize the Pos */ for(t=0;t<IP->nNumMotifTypes;t++) { Pos_t=Pos[t]; for(i = 0; i < IP->nSeqLen; i++) { Pos_t[i].nInMotif=FALSE; Pos_t[i].nMotifStartPos=FALSE; } } for( t= 0; t < IP->nNumMotifTypes; t++ ) /* BT 5/23/97 */ { IP->nMotifLen[t] = IP->nInputMotifLen[t]; /* restore original lengths */ SetPossibleSites( B, t ); /* restore original site count */ } if( IP->is_defined[cl_d] && ! IP->inCentroidAlign ) set_indicator_vector(Pos, B->Seq, B); if( ! IP->site_samp ) /* BT 7/16/97 */ set_posterior_prob(IP, B->C); /* Set initial posterior prob */ /* random select a set of motifs */ if( ! IP->is_defined[cl_V] ) /* BT 04/16/03 */ { if( B->InitPos == NULL || seed_run > 1 ) { if( IP->is_defined[cl_A] ) { set_posterior_prob(IP, B->C); for( t = 0; t < IP->nNumMotifTypes; t++ ) { IP->nNumMotifs[t][FORWARD] = 0; IP->nNumMotifs[t][REVERSE] = 0; } } set_random_sequences(B, Pos, startPos); /* set alignment &*/ } else { SetInitSequences( B, Pos, startPos ); /* BT 8/5/98 */ set_posterior_prob(IP, B->First); if( RP->bUsePosMatrix ) InitializePosMatrix( B ); else if( RP->bUseTrans ) InitializeTransMatrix( B ); } } else { if( B->InitPos == NULL ) { for( t = 0; t < IP->nNumMotifTypes; t++ ) { IP->nNumMotifs[t][FORWARD] = 0; IP->nNumMotifs[t][REVERSE] = 0; } } else { SetInitSequences( B, Pos, startPos ); set_counts( B ); /* BT 10/23/03 */ set_posterior_prob(IP, B->First); } set_posterior_prob(IP, B->C); } reset_counts(B, startPos, Pos); /* its counts */ if( B->InitPos != NULL && seed_run == 1 ) { RP->dInitProb = CalcMapProb( B, IP->is_defined[cl_R] ); if( ! IP->inCentroidAlign ) { fprintf( IP->Datafiles->out_fpt, "seed = %d Initial MAP = %.5f sites = %d \n", IP->nSeedRun, RP->dInitProb, TotalNumMotifs( B )); for( t = 0; t < IP->nNumMotifTypes; t++ ) { fprintf(IP->Datafiles->out_fpt, "Motif %d Map = %.5f Frag = %.5f\n", t, CalcMotifMap(B, t, IP->is_defined[cl_R]), CalcMotifFragMap(B, t, IP->is_defined[cl_R]) ); } } #ifdef _MPI_ PrintTempOut( IP->Datafiles->mpiTemp_fpt, "rank = %d process = %d seed = %d Initial MAP = %.5f sites = %d\n", IP->nRank, IP->nMPIProcesses, IP->nSeedRun, RP->dInitProb, TotalNumMotifs( B ) ); for( t = 0; t < IP->nNumMotifTypes; t++ ) { PrintTempOut( IP->Datafiles->mpiTemp_fpt, "%d Motif = %.5f Frag = %.5f\n", t, CalcMotifMap(B, t, IP->is_defined[cl_R]), CalcMotifFragMap(B, t, IP->is_defined[cl_R]) ); } PrintTempOut( IP->Datafiles->mpiTemp_fpt, "Bkgnd = %.5f Beta = %.5f Null = %.5f\n", CalcBkgndMap(B, IP->is_defined[cl_R]), CalcBetaMap( B, IP->is_defined[cl_R]), IP->dnull_map ); #else fprintf( stdout, "seed = %d Initial MAP = %.5f sites = %d\n", IP->nSeedRun, B->RP->dInitProb, TotalNumMotifs( B ) ); for( t = 0; t < IP->nNumMotifTypes; t++ ) { fprintf( stdout, "%d Motif = %.5f Frag = %.5f\n", t, CalcMotifMap(B, t, IP->is_defined[cl_R]), CalcMotifFragMap(B, t, IP->is_defined[cl_R]) ); } fprintf( stdout, "Bkgnd = %.5f Beta = %.5f Seq = %.5f Null = %.5f\n", CalcBkgndMap(B, IP->is_defined[cl_R]), CalcBetaMap( B, IP->is_defined[cl_R]), CalcSitePerSeqMap( B ), IP->dnull_map ); #endif for( t = 0; t < IP->nNumMotifTypes; t++ ) { fprintf( stdout, "-----------------------------------------------------------\n" ); fprintf( stdout, " MOTIF %c\n\n", (char)(97 + t)); DumpMotifPositions( t, B, Pos, stdout ); fprintf( stdout, "%d sites\n", NUMMOTIFS( IP->nNumMotifs[t]) ); } fflush( stdout ); } /* create a motif element list */ M = set_motif_info(IP, startPos, B->Seq); #ifdef _DEBUG_ /* ==================================================================== */ for( t = 0; t < IP->nNumMotifTypes; t++ ) { fprintf( stdout, "-----------------------------------------------------------\n" ); fprintf( stdout, " MOTIF %c\n\n", (char)(97 + t)); DumpMotifPositions( t, B, Pos, stdout ); fprintf( stdout, "%d sites\n", NUMMOTIFS( IP->nNumMotifs[t]) ); DumpCounts( B, t, stdout ); fflush( stdout ); } /* ==================================================================== */ #endif if( ! IP->is_defined[cl_Z] ) { put_prior(B); fprintf(stdout, "\r** %d **\n", seed_run); fflush( stdout ); /* BT 9/19/97 */ } if(seed_run > 1) { RestoreAlignmentCounts( B ); if(IP->site_samp) locMax = site_sampler(B, Pos, M); else if( IP->is_defined[cl_bayes] ) locMax = bayes_sampler(B, Pos, M, seed_run); else if( IP->is_defined[cl_E] ) locMax = rsite_sampler(B, Pos, M, seed_run); else locMax = motif_sampler(B,Pos,M); if( IP->is_defined[cl_X] ) CopyMaxResults( &(B->AN->results[seed_run]), &locMax, B ); dCurrProb = locMax.dProbability; if(locMax.dProbability > maxData.dProbability) { /* Check to see if current run is max */ free_maxdata(&maxData, IP); maxData = locMax; maxData.nSuboptSeed = seed_run; if( (! IP->is_defined[cl_Z]) && IP->is_defined[cl_opt] ) print_maxData(IP->nNumMotifTypes, maxData); } else free_maxdata(&locMax, IP); } else { /* Set Maximum first time through */ if(IP->site_samp) maxData = site_sampler(B, Pos, M); else if( IP->is_defined[cl_bayes] ) maxData = bayes_sampler(B, Pos, M, seed_run); else if( IP->is_defined[cl_E] ) maxData = rsite_sampler(B, Pos, M, seed_run); else maxData = motif_sampler(B,Pos,M); dCurrProb = maxData.dProbability; maxData.nSuboptSeed = seed_run; if( IP->is_defined[cl_X] ) CopyMaxResults( &(B->AN->results[seed_run]), &maxData, B ); if( (! IP->is_defined[cl_Z]) && IP->is_defined[cl_opt] ) print_maxData(IP->nNumMotifTypes, maxData); } reset_motif_num(nNumMotifs, IP); copy_counts(B); /* Counts w/o motifs */ free_motifs(B, M); #ifdef _MPI_ if( IP->is_defined[cl_hm] ) { if( seed_run == IP->nSeeds ) SendSuboptMsg( B, G_MPI_SUBOPT_DONE, seed_run ); else SendSuboptMsg( B, G_MPI_SEED_DONE, seed_run ); } else { dTempInfo[1] = dCurrProb; dTempInfo[3] = 0; if( IP->is_defined[cl_opt] ) { for(t = 0; t < IP->nNumMotifTypes; t++) { dTempInfo[3] += (double) maxData.nNumMotifs[t]; } } Gibbs_MPI_Send( B, dTempInfo, 4, MPI_DOUBLE, 0, G_MPI_DATA, MPI_COMM_WORLD ); } Gibbs_MPI_Recv( B, dTempInfo, 4, MPI_DOUBLE, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &status ); if( status.MPI_TAG == G_MPI_DONE ) { PrintTempOut( IP->Datafiles->mpiTemp_fpt, "Received MPI_DONE signal\n" ); break; } else if( status.MPI_TAG == G_MPI_FINISH ) { PrintTempOut( IP->Datafiles->mpiTemp_fpt, "Received subopt end signal\n" ); break; } #endif }/* end of while loop, at this time we have MaxData */ FREEP(startPos,IP->nNumMotifTypes ); if(!IP->is_defined[cl_F] && maxData.F) { for(t = 0; t < IP->nNumMotifTypes; t++) /* BT 2/7/97 */ { for(n = 0; n < B->F->nMaxLen[t]; n++) B->F->nColMask[t][n] = maxData.F->nColMask[t][n]; B->F->FragWidth[t] = maxData.F->FragWidth[t]; for( n = 0; n < IP->nMotifLen[t]; n++ ) B->F->fragPos[t][n] = maxData.F->fragPos[t][n]; } } for(t = 0; t < IP->nNumMotifTypes; t++) { /* Add in motifs */ if( maxData.nMotifLen ) IP->nMotifLen[t] = maxData.nMotifLen[t]; /* Reset Pos in case width changed */ if( ! IP->inCentroidAlign ) set_indicator_vector(Pos, B->Seq, B); /* BT 9/12/97 */ if( maxData.nNumMotifs ) { for(i = 0; i < maxData.nNumMotifs[t]; i++) /* from the maximum */ adjust_counts(B, ADD, maxData.nMotifLoc[i][t], /* alignment */ t, maxData.RevComp[i][t]); } } if( maxData.nNumMotifs ) { setMotifNum(IP, maxData); /* BT 5/30/97 */ } if( IP->is_defined[cl_u] ) print_info(B, maxData, TRUE, SUBOPT); /* BT 3/19/97 */ if( IP->is_defined[cl_d] && IP->is_defined[cl_q] ) GetWidthCounts( B ); FREEP(nNumMotifs, IP->nNumMotifTypes); free(nNumMotifs); if( IP->is_defined[cl_Q] ) /* BT 3/27/98 */ { fprintf( IP->Datafiles->occur_fpt, "seq pos pos2 motif count\n" ); for( i = 0; i < IP->nNumSequences; i++ ) { for( j = 0; j < SequenceLength( B, i ); j++ ) { nPos = SequenceStartPos( B, i ) + j; for( t = 0; t < IP->nNumMotifTypes; t++ ) { for( sum = 0, k = 1; k <= IP->nSeeds; k++ ) { sum += IP->nAlignCnts[k][t][i][j]; } fprintf( IP->Datafiles->occur_fpt, "%5d %5d %5d %5d %5d\n", i, j, nPos, t, sum ); } } fflush( IP->Datafiles->occur_fpt ); } } if( ! IP->is_defined[cl_Z] && ! IP->is_defined[cl_nopt] ) printf( "Max subopt MAP found on seed %d\n", maxData.nSuboptSeed ); return maxData; }
int main(int argc, char** argv) { if (argc>1 && strstr(argv[1],"debug")) debug_mode=1; if (argc>1 && strstr(argv[1],"oneshot")) one_shot_mode=1; if (getenv("IRQBALANCE_BANNED_CPUS")) { cpumask_parse_user(getenv("IRQBALANCE_BANNED_CPUS"), strlen(getenv("IRQBALANCE_BANNED_CPUS")), banned_cpus); } if (getenv("IRQBALANCE_ONESHOT")) one_shot_mode=1; if (getenv("IRQBALANCE_DEBUG")) debug_mode=1; parse_cpu_tree(); /* On single core UP systems irqbalance obviously has no work to do */ if (core_count<2) exit(EXIT_SUCCESS); /* On dual core/hyperthreading shared cache systems just do a one shot setup */ if (cache_domain_count==1) one_shot_mode = 1; if (!debug_mode) if (daemon(0,0)) exit(EXIT_FAILURE); #ifdef HAVE_LIBCAP_NG // Drop capabilities capng_clear(CAPNG_SELECT_BOTH); capng_lock(); capng_apply(CAPNG_SELECT_BOTH); #endif parse_proc_interrupts(); sleep(SLEEP_INTERVAL/4); reset_counts(); parse_proc_interrupts(); pci_numa_scan(); calculate_workload(); sort_irq_list(); if (debug_mode) dump_workloads(); while (1) { sleep_approx(SLEEP_INTERVAL); if (debug_mode) printf("\n\n\n-----------------------------------------------------------------------------\n"); check_power_mode(); parse_proc_interrupts(); /* cope with cpu hotplug -- detected during /proc/interrupts parsing */ if (need_cpu_rescan) { need_cpu_rescan = 0; /* if there's a hotplug event we better turn off power mode for a bit until things settle */ power_mode = 0; if (debug_mode) printf("Rescanning cpu topology \n"); reset_counts(); clear_work_stats(); clear_cpu_tree(); parse_cpu_tree(); } /* deal with NAPI */ account_for_nic_stats(); calculate_workload(); /* to cope with dynamic configurations we scan for new numa information * once every 5 minutes */ if (counter % NUMA_REFRESH_INTERVAL == 16) pci_numa_scan(); calculate_placement(); activate_mapping(); if (debug_mode) dump_tree(); if (one_shot_mode) break; counter++; } return EXIT_SUCCESS; }