本文整理汇总了C++中TIMER_START函数的典型用法代码示例。如果您正苦于以下问题:C++ TIMER_START函数的具体用法?C++ TIMER_START怎么用?C++ TIMER_START使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TIMER_START函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST_F
TEST_F(Benchmark, ZeroMQ)
{
TIMER_START(1000000);
::zmq::message_t *msg = new ::zmq::message_t();
delete msg;
TIMER_END("zmq.empty_message_allocation");
TIMER_START(1000000);
::zmq::message_t *msg = new ::zmq::message_t(100);
delete msg;
TIMER_END("zmq.100_byte_message_allocation");
TIMER_START(1000000);
::zmq::message_t *msg = new ::zmq::message_t(1000);
delete msg;
TIMER_END("zmq.1000_byte_message_allocation");
TIMER_START(100000);
::zmq::message_t *msg = new ::zmq::message_t(10000);
delete msg;
TIMER_END("zmq.10000_byte_message_allocation");
TIMER_START(10000);
::zmq::message_t *msg = new ::zmq::message_t(100000);
delete msg;
TIMER_END("zmq.100000_byte_message_allocation");
zmq_socket_send_recv("inproc://00", ZMQ_PUSH, ZMQ_PULL, 0, 1000000, "zmq.socket.inproc.pushpull.empty");
zmq_socket_send_recv("inproc://01", ZMQ_PUSH, ZMQ_PULL, 100, 1000000, "zmq.socket.inproc.pushpull.100_byte_message");
zmq_socket_send_recv("inproc://02", ZMQ_PUSH, ZMQ_PULL, 1000, 1000000, "zmq.socket.inproc.pushpull.1000_byte_message");
zmq_socket_send_recv("inproc://03", ZMQ_PUSH, ZMQ_PULL, 10000, 1000000, "zmq.socket.inproc.pushpull.10000_byte_message");
zmq_socket_send_recv("inproc://04", ZMQ_PUSH, ZMQ_PULL, 100000, 100000, "zmq.socket.inproc.pushpull.100000_byte_message");
zmq_socket_send_recv("inproc://05", ZMQ_PUSH, ZMQ_PULL, 1000000, 100000, "zmq.socket.inproc.pushpull.1000000_byte_message");
}
示例2: IR_state
void IR_state (uint8_t nextState)
{
switch (nextState) {
case IR_IDLE:
IR_TX_OFF();
IR_COMPARE_DISABLE();
// 1st interrupt when receiving ir must be falling edge
IR_CAPTURE_FALL();
IR_CAPTURE_ENABLE();
IR_clear();
break;
case IR_RECVING:
IR_clear();
TIMER_START( IrCtrl.recv_timer, RECV_TIMEOUT );
break;
case IR_RECVED:
TIMER_STOP( IrCtrl.recv_timer );
irpacker_packend( &packer_state );
// disable til IRKit.cpp reports IR data to server
IR_CAPTURE_DISABLE();
IR_COMPARE_DISABLE();
if (IrCtrl.len < VALID_IR_LEN_MIN) {
// received, but probably noise
IR_state( IR_IDLE );
return;
}
break;
case IR_RECVED_IDLE:
// holds received IR data, and ready to receive next
IR_CAPTURE_FALL();
IR_CAPTURE_ENABLE();
break;
case IR_READING:
irpacker_unpack_start( &packer_state );
IR_CAPTURE_DISABLE();
IR_COMPARE_DISABLE();
break;
case IR_WRITING:
IR_CAPTURE_DISABLE();
IR_COMPARE_DISABLE();
IR_clear();
break;
case IR_XMITTING:
IR_CAPTURE_DISABLE();
IR_COMPARE_DISABLE();
IrCtrl.tx_index = 0;
TIMER_START( IrCtrl.xmit_timer, XMIT_TIMEOUT );
break;
case IR_DISABLED:
IR_CAPTURE_DISABLE();
IR_COMPARE_DISABLE();
break;
}
IrCtrl.state = nextState;
}
示例3: TIMER_START
void EdgeBasedGraphFactory::Run(const std::string &original_edge_data_filename,
const std::string &geometry_filename,
lua_State *lua_state)
{
TIMER_START(geometry);
CompressGeometry();
TIMER_STOP(geometry);
TIMER_START(renumber);
RenumberEdges();
TIMER_STOP(renumber);
TIMER_START(generate_nodes);
GenerateEdgeExpandedNodes();
TIMER_STOP(generate_nodes);
TIMER_START(generate_edges);
GenerateEdgeExpandedEdges(original_edge_data_filename, lua_state);
TIMER_STOP(generate_edges);
m_geometry_compressor.SerializeInternalVector(geometry_filename);
SimpleLogger().Write() << "Timing statistics for edge-expanded graph:";
SimpleLogger().Write() << "Geometry compression: " << TIMER_SEC(geometry) << "s";
SimpleLogger().Write() << "Renumbering edges: " << TIMER_SEC(renumber) << "s";
SimpleLogger().Write() << "Generating nodes: " << TIMER_SEC(generate_nodes) << "s";
SimpleLogger().Write() << "Generating edges: " << TIMER_SEC(generate_edges) << "s";
}
示例4: TIMER_START
double ProblemDescription::evaluateConstraint( const double * xi,
double * h,
double * H )
{
if ( factory.empty() ) {return 0; }
TIMER_START( "constraint" );
assert( h ); // make sure that h is not NULL
prepareData( xi );
MatMap h_map( h, factory.numOutput(), 1 );
if ( !H ){
const double val = factory.evaluate( trajectory, h_map );
TIMER_STOP( "constraint" );
return val;
}
MatMap H_map( H, trajectory.size(), factory.numOutput() );
double magnitude = factory.evaluate(trajectory, h_map, H_map );
if( doing_covariant ){
//TODO find out if this is correct
MatMap H_map2( H, trajectory.N(),
trajectory.M()*factory.numOutput() );
metric.multiplyLowerInverse( H_map2 );
}
TIMER_STOP( "constraint" );
return magnitude;
}
示例5: parse_add_locinfov
LocInfo* parse_add_locinfov(Parse *p,char *filename, int lineno, char *line, char *tag, char *referrer, char *context_in,va_list args)
{
char buf[128];
char *ctxt = context_in;
LocInfo *l;
TIMER_START();
if(ctxt)
{
vsnprintf(buf,DIMOF(buf),ctxt,args);
buf[DIMOF(buf)-1] = 0;
ctxt = buf;
}
p->n_locs++;
l = ali_push(&p->locs);
l->tag = parse_find_add_str(p,tag);
l->referrer = parse_find_add_str(p,referrer);
l->context = parse_find_add_str(p,ctxt);
l->fname = parse_find_add_str(p,filename);
l->lineno = lineno;
l->line = parse_find_add_str(p,line);
TIMER_END(locinfo_timer);
return l;
}
示例6: main
int main(int argc, char** argv){
int n;
if (argc > 1)
n = atoi(argv[1]);
else
n = 40;
if (cilk_io_init()) {
fprintf(stderr,"cilk_io_init failed\n");
exit(1);
}
int socketID;
long j;
int i;
int arr[NUM_SERVERS];
int* sockIDs = initReduce();
my_timer_t t;
TIMER_START(t);
// Currently it only works if cilk_read/writes are within a cilk_spawn
cilk_spawn distPfib(n, sockIDs, &j);
TIMER_STOP(t);
printf("computed distFib of %d\treturned: %lu\ttime: %4f\n", n, j, TIMER_EVAL(t));
return 0;
}
示例7: generate_level
void generate_level(Level *lvl, char *id) {
LevelGeneratorFunc func = NULL;
unsigned i;
clock_t t;
/* If 'id' is null, go with the default: */
if(!id) id = GENERATOR_LIST[0].id;
/* Look for the id: */
for(i=0; GENERATOR_LIST[i].id; i++) {
if(!strcmp(id, GENERATOR_LIST[i].id)) {
gamelib_print("Using level generator: '%s'\n", GENERATOR_LIST[i].id);
func = GENERATOR_LIST[i].gen;
goto generate_level;
}
}
/* Report what level generator we found: */
gamelib_print("Couldn't find level generator: '%s'\n", id);
gamelib_print("Using default level generator: '%s'\n", GENERATOR_LIST[0].id);
/* If we didn't find the id, then we select the default: */
if(!func) func = GENERATOR_LIST[0].gen;
generate_level:
TIMER_START(t);
/* Ok, now generate the level: */
func(lvl);
gamelib_print("Level generated in: ");
TIMER_STOP(t);
}
示例8: long_press_button_ontimer
void long_press_button_ontimer( struct long_press_button_state_t* state ) {
static uint8_t button_state = BUTTON_OFF;
uint8_t next_button_state = digitalRead( state->pin );
if ((BUTTON_OFF == button_state) &&
(BUTTON_ON == next_button_state)) {
// OFF -> ON
TIMER_START( state->timer, state->threshold_time );
}
else if ((BUTTON_ON == button_state) &&
(BUTTON_ON == next_button_state)) {
// still pressing
TIMER_TICK( state->timer );
if (TIMER_FIRED( state->timer )) {
state->callback();
// fires again after state->threshold_time
button_state = BUTTON_OFF;
return;
}
}
button_state = next_button_state;
}
示例9: test_sbit_cache
int
test_sbit_cache( btimer_t* timer,
FT_Face face,
void* user_data )
{
FTC_SBit glyph;
int i, done = 0;
FT_UNUSED( user_data );
if ( !sbit_cache )
{
if ( FTC_SBitCache_New(cache_man, &sbit_cache) )
return 0;
}
TIMER_START( timer );
for ( i = 0; i < face->num_glyphs; i++ )
{
if ( !FTC_SBitCache_Lookup(sbit_cache, &font_type, i, &glyph, NULL) )
done++;
}
TIMER_STOP( timer );
return done;
}
示例10: test_cmap_cache
int
test_cmap_cache( btimer_t* timer,
FT_Face face,
void* user_data )
{
bcharset_t* charset = (bcharset_t*)user_data;
int i, done = 0;
FT_UNUSED( face );
if ( !cmap_cache )
{
if ( FTC_CMapCache_New(cache_man, &cmap_cache) )
return 0;
}
TIMER_START( timer );
for ( i = 0; i < charset->size; i++ )
{
if ( FTC_CMapCache_Lookup( cmap_cache, font_type.face_id, 0, charset->code[i] ) )
done++;
}
TIMER_STOP( timer );
return done;
}
示例11: test_get_cbox
int
test_get_cbox( btimer_t* timer,
FT_Face face,
void* user_data )
{
FT_Glyph glyph;
FT_BBox bbox;
int i, done = 0;
FT_UNUSED( user_data );
for ( i = 0; i < face->num_glyphs; i++ )
{
if ( FT_Load_Glyph( face, i, load_flags ) )
continue;
if ( FT_Get_Glyph( face->glyph, &glyph ) )
continue;
TIMER_START( timer );
FT_Glyph_Get_CBox( glyph, FT_GLYPH_BBOX_PIXELS, &bbox );
TIMER_STOP( timer );
FT_Done_Glyph( glyph );
done++;
}
return done;
}
示例12: TIMER_START
/**
* Tests inserting blob data as a stream
*
* @throws Exception
* if an error occurs
*/
void BlobTest::testBlobInsert( Connection & c, bool asString )
{
TIMER_START( "Populating blob table" );
pstmt.reset( conn->prepareStatement("INSERT INTO BLOBTEST(blobdata) VALUES (?)") );
if ( asString )
{
sql::SQLString str;
testBlobFile->readFile( const_cast<std::string&>(str.asStdString()) );
pstmt->setString( 1, str );
pstmt->execute();
}
else
{
std::fstream & bIn= testBlobFile->getStream();
ASSERT( ! bIn.fail() );
pstmt->setBlob( 1, & bIn );
pstmt->execute();
}
TIMER_STOP("Populating blob table");
pstmt->clearParameters();
doRetrieval();
}
示例13: TIMER_START
uint32_t CFrontend::getDiseqcReply(const int timeout_ms) const
{
struct dvb_diseqc_slave_reply reply;
reply.timeout = timeout_ms;
TIMER_START();
if (fop(ioctl, FE_DISEQC_RECV_SLAVE_REPLY, &reply) < 0)
return 0;
TIMER_STOP();
/* timeout */
if (reply.msg_len == 0)
return 1;
switch (reply.msg[0]) {
case 0xe4: /* ok */
return 0;
case 0xe5: /* invalid address or unknown command */
return 1;
case 0xe6: /* parity error */
return 1;
case 0xe7: /* contention flag mismatch */
return 1;
default: /* unexpected reply */
return 0;
}
}
示例14: TIMER_START
/* save screenshot in bmp format, return true if success, or false */
bool CScreenShot::SaveBmp()
{
TIMER_START();
if(!OpenFile())
return false;
unsigned char hdr[14 + 40];
unsigned int i = 0;
#define PUT32(x) hdr[i++] = ((x)&0xFF); hdr[i++] = (((x)>>8)&0xFF); hdr[i++] = (((x)>>16)&0xFF); hdr[i++] = (((x)>>24)&0xFF);
#define PUT16(x) hdr[i++] = ((x)&0xFF); hdr[i++] = (((x)>>8)&0xFF);
#define PUT8(x) hdr[i++] = ((x)&0xFF);
PUT8('B'); PUT8('M');
PUT32((((xres * yres) * 3 + 3) &~ 3) + 14 + 40);
PUT16(0); PUT16(0); PUT32(14 + 40);
PUT32(40); PUT32(xres); PUT32(yres);
PUT16(1);
PUT16(4*8); // bits
PUT32(0); PUT32(0); PUT32(0); PUT32(0); PUT32(0); PUT32(0);
#undef PUT32
#undef PUT16
#undef PUT8
fwrite(hdr, 1, i, fd);
int y;
for (y=yres-1; y>=0 ; y-=1) {
fwrite(pixel_data+(y*xres*4),xres*4,1,fd);
}
fclose(fd);
TIMER_STOP(filename.c_str());
return true;
}
示例15: Delayms
void Delayms (uint32_t ms)
{
TIMER_STOP();
TIMER_START(ms * 1000);
while (!TIMER_EXPIRED());
TIMER_STOP();
}