当前位置: 首页>>代码示例>>C++>>正文


C++ STOP_TIMER函数代码示例

本文整理汇总了C++中STOP_TIMER函数的典型用法代码示例。如果您正苦于以下问题:C++ STOP_TIMER函数的具体用法?C++ STOP_TIMER怎么用?C++ STOP_TIMER使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了STOP_TIMER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[]) {
	struct timeval start_time, stop_time;
	size_t i;
	int test_size = atoi(argv[1]);
	int hash_table_size = atoi(argv[2]);

	void** tmp = malloc(test_size * sizeof(void*));
	assert(tmp != NULL);

	HashTable* hash_table = hash_table_create(hash_table_size);
	printf("%d put operations .........................: ", test_size);
	fflush(stdout);
	START_TIMER(start_time);
	for (i = 0; i < test_size; ++i) {
		tmp[i] = malloc(sizeof(void));
		assert(tmp[i] != NULL);
		hash_table_insert(hash_table, (void*) tmp[i]);
	}
	STOP_TIMER(stop_time);
	printf("%.3f milisecs\n", TIME_DIFF(start_time, stop_time) / 1000);

	printf("Iterating .........................: ");
	fflush(stdout);
	START_TIMER(start_time);
	HashTableIterator* it = hash_table_iterator_create(hash_table);
	void* e = hash_table_iterator_next(it);
	while (e) {
		e = hash_table_iterator_next(it);
	}
	STOP_TIMER(stop_time);
	printf("done in %.3f milisecs\n", TIME_DIFF(start_time, stop_time) / 1000);

	return 1;
}
开发者ID:sertkaya,项目名称:elephant-reasoner,代码行数:34,代码来源:test_hash_table_performance.c

示例2: timer

static void timer(ENTRY *entry)
{
    switch (entry->state) {
	case as_resolv:
	    arp_request(entry->itf,entry->ip);
	    break;
	case as_invalid:
	    if (entry->vccs) inarp_request(entry);
	    else if (!(entry->flags & ATF_ARPSRV))
		    diag(COMPONENT,DIAG_INFO,"as_invalid, no VCCs, but not "
		      "ARP server entry");
			/* this is a valid condition if we're the ATMARP server
			   and the remote disconnected */
		    else if (!want_arp_srv(entry->itf)) STOP_TIMER(entry);
	    break;
	case as_valid:
	    if (entry->flags & ATF_ARPSRV) {
		if (!want_arp_srv(entry->itf)) STOP_TIMER(entry);
		break;
	    }
	    /* fall through */
	default:
	    diag(COMPONENT,DIAG_FATAL,"timer in state %d",entry->state);
    }
}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:25,代码来源:arp.c

示例3: myContext

bool
RenderArea::on_expose_event (GdkEventExpose *event) {
    try {
        /*GdkGLDrawable *gldrawable =*/ gtk_widget_get_gl_drawable (GTK_WIDGET(gobj()));
        ScopedGLContext myContext(this);

        if (_myRenderer && _myScene) {
            if (_isFirstFrame) {
                _myRenderer->getCurrentScene()->updateAllModified();
                _isFirstFrame = false;
            }

            STOP_TIMER(frames);
            asl::getDashboard().cycle();
            START_TIMER(frames);

            onFrame();

            //START_TIMER(dispatchEvents);
            //y60::EventDispatcher::get().dispatch();
            //STOP_TIMER(dispatchEvents);

            START_TIMER(handleRequests);
            _myRequestManager.handleRequests();
            STOP_TIMER(handleRequests);

            renderFrame();
            swapBuffers();

            /** done rendering **/
        } else {
            // nothing to render... just clear the buffer to avoid pixel garbage
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
            swapBuffers();
        }

        if (_myJSContext) {
            MAKE_SCOPE_TIMER(gc);
            JS_GC(_myJSContext);
        }
    } catch (const asl::Exception & ex) {
        AC_FATAL << "Exception caught: " << ex;
    } catch (const exception & ex) {
        AC_FATAL << "Exception caught: " << ex.what();
    } catch (...) {
        AC_FATAL << "Unknown exception";
    }
    return true;
}
开发者ID:modemuser,项目名称:y60,代码行数:49,代码来源:RenderArea.cpp

示例4: STOP_TIMER

void testNet::testServerFinished(QNetworkReply* reply)
{
	STOP_TIMER(testNetTimer);
	QNetworkReply::NetworkError error=reply->error();
	if(!error)
	{
		QString replybuf(reply->readAll().trimmed());
		switch(mode){
			case TEST_SERVER_NET:				
				if(replybuf.startsWith(QString("1")))
				{
					SET_RUN_PARAMETER(RUN_PARAMETER_TESTNET_RESULT,TEST_NET_SUCCESS);
				}
			break;
			case TEST_SERVER_VERSION:
				{
					qDebug()<<replybuf;
					QRegExp verre("^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$");
					if(verre.exactMatch(replybuf)){
						QDEBUG_LINE;	
						QStringList s_version = replybuf.split(".");
						QStringList l_version = QString(APP_VERSION).split(".");
						 for (int i = 0; i < s_version.size(); ++i)
       							{ 
       								if(s_version.at(i).toUInt()>l_version.at(i).toUInt())
       								{
       									SET_RUN_PARAMETER(RUN_PARAMETER_TESTNET_VERSION,1);
									break;
       								}       								
						 	}						
					}
				}
			break;
		}		
	}else{
开发者ID:Voskrese,项目名称:mipsonqemu,代码行数:35,代码来源:bmnet.cpp

示例5: main

int main(void)
{
    int x = 0;
    int i, j;
    AVLFG state;

    av_lfg_init(&state, 0xdeadbeef);
    for (j = 0; j < 10000; j++) {
        START_TIMER
        for (i = 0; i < 624; i++)
            x += av_lfg_get(&state);
        STOP_TIMER("624 calls of av_lfg_get");
    }
    av_log(NULL, AV_LOG_ERROR, "final value:%X\n", x);

    /* BMG usage example */
    {
        double mean   = 1000;
        double stddev = 53;

        av_lfg_init(&state, 42);

        for (i = 0; i < 1000; i += 2) {
            double bmg_out[2];
            av_bmg_get(&state, bmg_out);
            av_log(NULL, AV_LOG_INFO,
                   "%f\n%f\n",
                   bmg_out[0] * stddev + mean,
                   bmg_out[1] * stddev + mean);
        }
    }

    return 0;
}
开发者ID:AVLeo,项目名称:libav,代码行数:34,代码来源:lfg-test.c

示例6: parseInternalPostgres

static Node *
parseInternalPostgres (void) //TODO make copyObject work first
{
    Node *result;
    START_TIMER("module - parser");

    NEW_AND_ACQUIRE_MEMCONTEXT("PARSER_CONTEXT");

    // parse
    int rc = postgresparse();
    if (rc)
    {
        ERROR_LOG("parse error!");
        return NULL;
    }

    STOP_TIMER("module - parser");

    DEBUG_LOG("query block model generated by parser is:\n%s\n\n%s",
            nodeToString(postgresParseResult),
            beatify(nodeToString(postgresParseResult)));

    // create copy of parse result in parent context
    FREE_MEM_CONTEXT_AND_RETURN_COPY(Node,postgresParseResult);
}
开发者ID:dayu070,项目名称:GProm,代码行数:25,代码来源:parser_postgres.c

示例7: main

int
main (int argc, char* argv[])
{
    char *result;

    READ_OPTIONS_AND_INIT("testrewriter", "Run all stages on input and output rewritten SQL.");

    START_TIMER("TOTAL");

    // read from terminal
    if (getStringOption("input.sql") == NULL)
    {
        result = rewriteQueryFromStream(stdin);
        ERROR_LOG("REWRITE RESULT FROM STREAM IS <%s>", result);
    }
    // parse input string
    else
    {
        result = rewriteQuery(getStringOption("input.sql"));
        ERROR_LOG("REWRITE RESULT FROM STRING IS:\n%s", result);
    }

    // call executor
    execute(result);

    STOP_TIMER("TOTAL");
    OUT_TIMERS();

    shutdownApplication();
//    freeOptions();
//    destroyMemManager();

    return EXIT_SUCCESS;
}
开发者ID:dayu070,项目名称:GProm,代码行数:34,代码来源:test_rewriter.c

示例8: ioctl_delete

static int ioctl_delete(ITF *itf,uint32_t ip,int flags)
{
    ENTRY *entry,*walk,*next;

    if (!(entry = lookup_ip(itf,ip))) {
	diag(COMPONENT,DIAG_WARN,"ioctl_delete didn't find entry");
	return -ENOENT;
    }
    if ((flags ^ entry->flags) & ATF_ARPSRV) return -EINVAL;
    send_notifications(entry,0);
    if ((entry->flags & ATF_ARPSRV) && entry->itf)
	for (walk = entry->itf->table; walk; walk = next) {
	    next = walk->next;
	    if (walk != entry && walk->state == as_resolv) {
		send_notifications(walk,0);
		if (!walk->vccs && !(walk->flags & ATF_PERM))
		   /* PERM is rather unlikely here, since this would be a
		      second ARP server (only ARP servers can go as_resolv if
		      PERM), but we'll check for it anyway. */
		    discard_entry(walk);
		else {
		    STOP_TIMER(walk);
		    walk->state = as_invalid;
		}
	    }
	}
    discard_entry(entry);
    return 0;
}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:29,代码来源:arp.c

示例9: input_done

static void input_done(void) {
    STOP_TIMER(clear_pam_wrong_timeout);
    pam_state = STATE_PAM_VERIFY;
    redraw_screen();

    if (pam_authenticate(pam_handle, 0) == PAM_SUCCESS) {
        DEBUG("successfully authenticated\n");
        clear_password_memory();
        /* Turn the screen on, as it may have been turned off
         * on release of the 'enter' key. */
        turn_monitors_on();

        /* PAM credentials should be refreshed, this will for example update any kerberos tickets.
         * Related to credentials pam_end() needs to be called to cleanup any temporary
         * credentials like kerberos /tmp/krb5cc_pam_* files which may of been left behind if the
         * refresh of the credentials failed. */
        pam_setcred(pam_handle, PAM_REFRESH_CRED);
        pam_end(pam_handle, PAM_SUCCESS);

        exit(0);
    }

    if (debug_mode)
        fprintf(stderr, "Authentication failure\n");

    pam_state = STATE_PAM_WRONG;
    failed_attempts += 1;
    clear_input();
    if (unlock_indicator)
        redraw_screen();

    /* Clear this state after 2 seconds (unless the user enters another
     * password during that time). */
    ev_now_update(main_loop);
    START_TIMER(clear_pam_wrong_timeout, TSTAMP_N_SECS(2), clear_pam_wrong);

    /* Cancel the clear_indicator_timeout, it would hide the unlock indicator
     * too early. */
    STOP_TIMER(clear_indicator_timeout);

    /* beep on authentication failure, if enabled */
    if (beep) {
        xcb_bell(conn, 100);
        xcb_flush(conn);
    }
}
开发者ID:ramnes,项目名称:i3lock,代码行数:46,代码来源:i3lock.c

示例10: adios_posix_should_buffer

enum ADIOS_FLAG adios_posix_should_buffer (struct adios_file_struct * fd
                                          ,struct adios_method_struct * method
                                          )
{
    struct adios_POSIX_data_struct * p = (struct adios_POSIX_data_struct *)
                                                          method->method_data;

    START_TIMER (ADIOS_TIMER_POSIX_AD_SHOULD_BUFFER);

    if (fd->shared_buffer == adios_flag_no && fd->mode != adios_mode_read)
    {
        // write the process group header
        adios_write_process_group_header_v1 (fd, fd->write_size_bytes);

        lseek (p->b.f, fd->base_offset, SEEK_SET);
        START_TIMER (ADIOS_TIMER_POSIX_MD);
        ssize_t s = write (p->b.f, fd->buffer, fd->bytes_written);
        STOP_TIMER (ADIOS_TIMER_POSIX_MD);
        if (s != fd->bytes_written)
        {
            fprintf (stderr, "POSIX method tried to write %llu, "
                             "only wrote %lld\n"
                    ,fd->bytes_written
                    ,(int64_t)s
                    );
        }
        fd->base_offset += s;
        fd->offset = 0;
        fd->bytes_written = 0;
        adios_shared_buffer_free (&p->b);

        // setup for writing vars
        adios_write_open_vars_v1 (fd);
        p->vars_start = lseek (p->b.f, fd->offset, SEEK_CUR);  // save loc
        p->vars_header_size = p->vars_start - fd->base_offset;  // the size
        p->vars_start -= fd->offset; // adjust to start of header
        fd->base_offset += fd->offset;  // add the size of the vars header
        fd->offset = 0;
        fd->bytes_written = 0;
        adios_shared_buffer_free (&p->b);
    }

    STOP_TIMER (ADIOS_TIMER_POSIX_AD_SHOULD_BUFFER);

    return fd->shared_buffer;   // buffer if there is space
}
开发者ID:acbauer,项目名称:ADIOS,代码行数:46,代码来源:adios_posix.c

示例11: clear_pam_wrong

/*
 * Resets pam_state to STATE_PAM_IDLE 2 seconds after an unsuccessful
 * authentication event.
 *
 */
static void clear_pam_wrong(EV_P_ ev_timer *w, int revents) {
    DEBUG("clearing pam wrong\n");
    pam_state = STATE_PAM_IDLE;
    unlock_state = STATE_STARTED;
    redraw_screen();

    /* Now free this timeout. */
    STOP_TIMER(clear_pam_wrong_timeout);
}
开发者ID:Kamori,项目名称:i3lock,代码行数:14,代码来源:i3lock.c

示例12: NS_START_STOPWATCH

/**
  * The parser uses a code sandwich to wrap the parsing process. Before
  * the process begins, WillBuildModel() is called. Afterwards the parser
  * calls DidBuildModel().
  * @update rickg 03.20.2000
  * @param  aParserContext
  * @param  aSink
  * @return error code (almost always 0)
  */
NS_IMETHODIMP
CViewSourceHTML::WillBuildModel(const CParserContext& aParserContext,
                                nsITokenizer* aTokenizer,
                                nsIContentSink* aSink)
{
  nsresult result=NS_OK;

#ifdef RAPTOR_PERF_METRICS
  vsTimer.Reset();
  NS_START_STOPWATCH(vsTimer);
#endif

  STOP_TIMER();
  mSink=(nsIHTMLContentSink*)aSink;

  if((!aParserContext.mPrevContext) && (mSink)) {

    nsAString & contextFilename = aParserContext.mScanner->GetFilename();
    mFilename = Substring(contextFilename,
                          12, // The length of "view-source:"
                          contextFilename.Length() - 12);

    mDocType=aParserContext.mDocType;
    mMimeType=aParserContext.mMimeType;
    mDTDMode=aParserContext.mDTDMode;
    mParserCommand=aParserContext.mParserCommand;
    mTokenizer = aTokenizer;

#ifdef DUMP_TO_FILE
    if (gDumpFile) {

      fprintf(gDumpFile, "<html>\n");
      fprintf(gDumpFile, "<head>\n");
      fprintf(gDumpFile, "<title>");
      fprintf(gDumpFile, "Source of: ");
      fputs(NS_ConvertUTF16toUTF8(mFilename).get(), gDumpFile);
      fprintf(gDumpFile, "</title>\n");
      fprintf(gDumpFile, "<link rel=\"stylesheet\" type=\"text/css\" href=\"resource://gre/res/viewsource.css\">\n");
      fprintf(gDumpFile, "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
      fprintf(gDumpFile, "</head>\n");
      fprintf(gDumpFile, "<body id=\"viewsource\">\n");
      fprintf(gDumpFile, "<pre id=\"line1\">\n");
    }
#endif //DUMP_TO_FILE
  }


  if(eViewSource!=aParserContext.mParserCommand)
    mDocType=ePlainText;
  else mDocType=aParserContext.mDocType;

  mLineNumber = 1;

  START_TIMER();

  return result;
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:66,代码来源:nsViewSourceHTML.cpp

示例13: rewriteProvenanceComputation

QueryOperator *
rewriteProvenanceComputation (ProvenanceComputation *op)
{
    // for a sequence of updates of a transaction merge the sequence into a single
    // query before rewrite.
    if (op->inputType == PROV_INPUT_UPDATE_SEQUENCE
            || op->inputType == PROV_INPUT_TRANSACTION)
    {
        START_TIMER("rewrite - merge update reenactments");
        mergeUpdateSequence(op);
        STOP_TIMER("rewrite - merge update reenactments");

        // need to restrict to updated rows?
        if (op->inputType == PROV_INPUT_TRANSACTION
                && HAS_STRING_PROP(op,PROP_PC_ONLY_UPDATED))
        {
            START_TIMER("rewrite - restrict to updated rows");
            restrictToUpdatedRows(op);
            STOP_TIMER("rewrite - restrict to updated rows");
        }
    }

    if (isRewriteOptionActivated(OPTION_TREEIFY_OPERATOR_MODEL))
    {
        treeify((QueryOperator *) op);
        INFO_LOG("treeifyed operator model:\n\n%s", operatorToOverviewString((Node *) op));
        DEBUG_LOG("treeifyed operator model:\n\n%s", beatify(nodeToString(op)));
        ASSERT(isTree((QueryOperator *) op));
    }

    switch(op->provType)
    {
        case PROV_PI_CS:
            if (isRewriteOptionActivated(OPTION_PI_CS_USE_COMPOSABLE))
                return rewritePI_CSComposable(op);
            else
                return rewritePI_CS(op);
        case PROV_TRANSFORMATION:
            return rewriteTransformationProvenance((QueryOperator *) op);
    }
    return NULL;
}
开发者ID:dayu070,项目名称:GProm,代码行数:42,代码来源:prov_rewriter_main.c

示例14: T4_stop

/*---------------------------------------------------------------------------*
 *	Timer T4 stop
 *---------------------------------------------------------------------------*/
static void
T4_stop(struct isic_softc *sc)
{
	NDBGL1(L1_T_MSG, "state = %s", isic_printstate(sc));

	if(sc->sc_I430T4)
	{
		sc->sc_I430T4 = 0;
		STOP_TIMER(sc->sc_T4_callout, timer4_expired, sc);
	}
}
开发者ID:Tommmster,项目名称:netbsd-avr32,代码行数:14,代码来源:isic_l1fsm.c

示例15: main

int main(void)
{
    int x = 0;
    int i, j;
    AVLFG state;

    av_lfg_init(&state, 0xdeadbeef);
    for (j = 0; j < 10000; j++) {
        START_TIMER
        for (i = 0; i < 624; i++) {
            //av_log(NULL, AV_LOG_ERROR, "%X\n", av_lfg_get(&state));
            x += av_lfg_get(&state);
        }
        STOP_TIMER("624 calls of av_lfg_get");
    }
    av_log(NULL, AV_LOG_ERROR, "final value:%X\n", x);

    /* BMG usage example */
    {
        double mean   = 1000;
        double stddev = 53;
        double samp_mean = 0.0, samp_stddev = 0.0;
        double samp0, samp1;

        av_lfg_init(&state, 42);

        for (i = 0; i < 1000; i += 2) {
            double bmg_out[2];
            av_bmg_get(&state, bmg_out);
            samp0 = bmg_out[0] * stddev + mean;
            samp1 = bmg_out[1] * stddev + mean;
            samp_mean += samp0 + samp1;
            samp_stddev += samp0 * samp0 + samp1 * samp1;
            av_log(NULL, AV_LOG_INFO,
                   "%f\n%f\n",
                   samp0,
                   samp1);
        }
        /* TODO: add proper normality test */
        samp_mean /= 1000;
        samp_stddev /= 999;
        samp_stddev -= (1000.0/999.0)*samp_mean*samp_mean;
        samp_stddev = sqrt(samp_stddev);
        av_log(NULL, AV_LOG_INFO, "sample mean  : %f\n"
                                  "true mean    : %f\n"
                                  "sample stddev: %f\n"
                                  "true stddev  : %f\n",
                                   samp_mean, mean, samp_stddev, stddev);
    }

    return 0;
}
开发者ID:0day-ci,项目名称:FFmpeg,代码行数:52,代码来源:lfg.c


注:本文中的STOP_TIMER函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。