本文整理汇总了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;
}
示例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);
}
}
示例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;
}
示例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{
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}
示例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
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}