本文整理汇总了C++中put_time函数的典型用法代码示例。如果您正苦于以下问题:C++ put_time函数的具体用法?C++ put_time怎么用?C++ put_time使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了put_time函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: put_time_info
//-----------------------------------------------------------------------------------
//void put_data_info : hien thi thong tin thu ngay thang tren lcd
//input: gia tri gio phut giay
//output: none
void put_time_info()
{
lcd_gotoxy(0,0);
lcd_puts(" ");
put_time(hour,4,0);
lcd_putchar(':');
put_time(minute,7,0);
lcd_putchar(':');
put_time(second,10,0);
lcd_gotoxy(12,0);
lcd_puts(" ");
}
示例2: Task_2
rtems_task Task_2(
rtems_task_argument argument
)
{
#if defined(RTEMS_SMP)
rtems_interrupt_level level;
#endif
Chain_Control *ready_queues;
#if (MUST_WAIT_FOR_INTERRUPT == 1)
while ( Interrupt_occurred == 0 );
#endif
end_time = benchmark_timer_read();
put_time(
"rtems interrupt: entry overhead returns to preempting task",
Interrupt_enter_time,
1,
0,
timer_overhead
);
put_time(
"rtems interrupt: exit overhead returns to preempting task",
end_time,
1,
0,
0
);
fflush( stdout );
/*
* Switch back to the other task to exit the test.
*/
#if defined(RTEMS_SMP)
rtems_interrupt_disable(level);
#endif
ready_queues = (Chain_Control *) _Scheduler.information;
_Thread_Executing =
(Thread_Control *) _Chain_First(&ready_queues[LOW_PRIORITY]);
_Thread_Dispatch_necessary = 1;
#if defined(RTEMS_SMP)
rtems_interrupt_enable(level);
#endif
_Thread_Dispatch();
}
示例3: Task_2
rtems_task Task_2(
rtems_task_argument argument
)
{
Thread_Control *executing = _Thread_Get_executing();
Scheduler_priority_Context *scheduler_context =
_Scheduler_priority_Get_context( _Scheduler_Get( executing ) );
ISR_lock_Context lock_context;
#if (MUST_WAIT_FOR_INTERRUPT == 1)
while ( Interrupt_occurred == 0 );
#endif
end_time = benchmark_timer_read();
put_time(
"rtems interrupt: entry overhead returns to preempting task",
Interrupt_enter_time,
1,
0,
timer_overhead
);
put_time(
"rtems interrupt: exit overhead returns to preempting task",
end_time,
1,
0,
0
);
fflush( stdout );
/*
* Switch back to the other task to exit the test.
*/
_Scheduler_Acquire( executing, &lock_context );
_Thread_Executing =
(Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY]);
_Thread_Dispatch_necessary = 1;
_Scheduler_Release( executing, &lock_context );
_Thread_Dispatch();
}
示例4: pthread_rwlock_wrlock
void *Low(
void *argument
)
{
int status;
benchmark_timer_t end_time;
/* write locking */
status = pthread_rwlock_wrlock(&rwlock);
end_time = benchmark_timer_read();
rtems_test_assert( status == 0 );
put_time(
"pthread_rwlock_unlock: thread waiting preempt",
end_time,
OPERATION_COUNT,
0,
0
);
TEST_END();
rtems_test_exit( 0 );
return NULL;
}
示例5: pthread_mutex_lock
void *Blocker(
void *argument
)
{
uint32_t end_time;
struct sched_param param;
int policy;
int status;
status = pthread_mutex_lock(&MutexID);
rtems_test_assert( status == 0 );
status = pthread_getschedparam(pthread_self(), &policy, ¶m);
rtems_test_assert( status == 0 );
param.sched_priority = sched_get_priority_max(policy) - 1;
status = pthread_setschedparam(pthread_self(), policy, ¶m);
/* Thread blocks, unlocks mutex, waits for CondID to be signaled */
pthread_cond_wait(&CondID,&MutexID);
/* Once signaled, this thread preempts POSIX_Init thread */
end_time = benchmark_timer_read();
put_time(
"pthread_cond_signal: thread waiting preempt",
end_time,
1,
0,
0
);
TEST_END();
rtems_test_exit( 0 );
return NULL;
}
示例6: rtems_time_test_measure_operation
void rtems_time_test_measure_operation(
const char *description,
rtems_time_test_method_t operation,
void *argument,
int iterations,
int overhead
)
{
int i;
uint32_t loop_overhead;
uint32_t end_time;
benchmark_timer_initialize();
for (i=0 ; i<iterations ; i++ ) {
benchmark_timer_empty_operation( i, argument );
}
loop_overhead = benchmark_timer_read();
benchmark_timer_initialize();
for (i=0 ; i<iterations ; i++ ) {
(*operation)( i, argument );
}
end_time = benchmark_timer_read();
put_time(
description,
end_time,
iterations,
loop_overhead,
overhead
);
}
示例7: High_task
rtems_task High_task(
rtems_task_argument argument
)
{
int index;
benchmark_timer_initialize();
for ( index=1 ; index < operation_count ; index++ )
(void) benchmark_timer_empty_function();
overhead = benchmark_timer_read();
benchmark_timer_initialize();
for ( index=1 ; index <= operation_count ; index++ )
(void) rtems_message_queue_urgent( Queue_id, Buffer, MESSAGE_SIZE );
end_time = benchmark_timer_read();
put_time(
"rtems_message_queue_urgent: task readied returns to caller",
end_time,
operation_count,
overhead,
0
);
TEST_END();
rtems_test_exit( 0 );
}
示例8: sched_yield
void *Low(
void *argument
)
{
benchmark_timer_t end_time;
/*
* Now we have finished the thread startup overhead,
* so let other threads run. When we return, we can
* finish the benchmark.
*/
sched_yield();
/* let other threads run */
end_time = benchmark_timer_read();
put_time(
"pthread_exit",
end_time,
OPERATION_COUNT,
0,
0
);
puts( "*** END OF POSIX TIME TEST PSXTMTHREAD03 ***" );
rtems_test_exit( 0 );
return NULL;
}
示例9: Task02
rtems_task Task02( rtems_task_argument ignored )
{
/* Benchmark code */
benchmark_timer_initialize();
for ( count = 0; count < BENCHMARKS; count++ ) {
if ( sem_exe == 1 ) {
rtems_semaphore_obtain( sem_id, RTEMS_WAIT, 0 );
}
rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
if ( sem_exe == 1 ) {
rtems_semaphore_release( sem_id );
}
rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
}
telapsed = benchmark_timer_read();
/* Check which run this was */
if (sem_exe == 0) {
tswitch_overhead = telapsed;
rtems_task_suspend( Task_id[0] );
rtems_task_suspend( RTEMS_SELF );
} else {
put_time(
"Rhealstone: Semaphore Shuffle",
telapsed,
(BENCHMARKS * 2), /* Total number of semaphore-shuffles*/
tswitch_overhead, /* Overhead of loop and task switches */
0
);
TEST_END();
rtems_test_exit( 0 );
}
}
示例10: High_task
rtems_task High_task(
rtems_task_argument argument
)
{
int index;
benchmark_timer_initialize();
for ( index=1 ; index < operation_count ; index++ )
(void) benchmark_timer_empty_function();
overhead = benchmark_timer_read();
benchmark_timer_initialize();
for ( index=1 ; index < operation_count ; index++ )
(void) rtems_message_queue_send( Queue_id, Buffer, MESSAGE_SIZE );
end_time = benchmark_timer_read();
put_time(
"rtems_message_queue_send: task readied -- returns to caller",
end_time,
operation_count - 1,
overhead,
CALLING_OVERHEAD_MESSAGE_QUEUE_SEND
);
puts( "*** END OF TEST 12 ***" );
rtems_test_exit( 0 );
}
示例11: main
int main(void) {
printf("現在は");
put_time();
printf("です。\n");
return 0;
}
示例12: sched_yield
void *Low(
void *argument
)
{
benchmark_timer_t end_time;
/*
* Now we have finished the thread startup overhead,
* so let other threads run. When we return, we can
* finish the benchmark.
*/
sched_yield();
/* let other threads run */
end_time = benchmark_timer_read();
put_time(
"pthread_mutex_lock: unavailable block",
end_time,
OPERATION_COUNT,
0,
0
);
TEST_END();
rtems_test_exit( 0 );
return NULL;
}
示例13: benchmark_mq_timedreceive
static void benchmark_mq_timedreceive(void)
{
benchmark_timer_t end_time;
int status;
unsigned int priority;
struct timespec timeout;
int message[MQ_MAXMSG];
priority = 1; /*priority low*/
timeout.tv_sec = 0;
timeout.tv_nsec = 0;
benchmark_timer_initialize();
status = mq_timedreceive(
queue2, ( char *)message, MQ_MSGSIZE, &priority, &timeout);
end_time = benchmark_timer_read();
rtems_test_assert( status != (-1) );
put_time(
"mq_timedreceive: available",
end_time,
1, /* Only executed once */
0,
0
);
}
示例14: benchmark_pthread_barrier_init
static void benchmark_pthread_barrier_init(void)
{
benchmark_timer_t end_time;
int status;
pthread_barrierattr_t attr;
/* initialize attr with default attributes
* for all of the attributes defined by the implementation
*/
status = pthread_barrierattr_init( &attr );
rtems_test_assert( status == 0 );
benchmark_timer_initialize();
status = pthread_barrier_init( &barrier,&attr, 1 );
end_time = benchmark_timer_read();
rtems_test_assert( status == 0 );
put_time(
"pthread_barrier_init",
end_time,
1, /* Only executed once */
0,
0
);
}
示例15: benchmark_pthread_setschedparam
void benchmark_pthread_setschedparam(void)
{
uint32_t end_time;
int status;
int policy;
struct sched_param param;
status = pthread_getschedparam( pthread_self(), &policy, ¶m );
rtems_test_assert( status == 0 );
/* Arbitrary priority, no other threads to preempt us so it doesn't matter. */
param.sched_priority = 5;
benchmark_timer_initialize();
status = pthread_setschedparam( pthread_self(), policy, ¶m );
end_time = benchmark_timer_read();
rtems_test_assert( status == 0 );
put_time(
"pthread_setschedparam: no thread switch",
end_time,
1, /* Only executed once */
0,
0
);
}