Lines Matching refs:impl
84 MppClockImpl *impl = mpp_calloc(MppClockImpl, 1); in mpp_clock_get() local
85 if (impl) { in mpp_clock_get()
86 impl->check = clock_name; in mpp_clock_get()
87 snprintf(impl->name, sizeof(impl->name) - 1, name, NULL); in mpp_clock_get()
91 return impl; in mpp_clock_get()
234 MppTimerImpl *impl = (MppTimerImpl *)ctx; in mpp_timer_thread() local
235 MppThread *thd = impl->thd; in mpp_timer_thread()
236 RK_S32 timer_fd = impl->timer_fd; in mpp_timer_thread()
239 ts.it_value.tv_sec = impl->initial / 1000; in mpp_timer_thread()
240 ts.it_value.tv_nsec = (impl->initial % 1000) * 1000; in mpp_timer_thread()
243 ts.it_interval.tv_sec = impl->interval / 1000; in mpp_timer_thread()
244 ts.it_interval.tv_nsec = (impl->interval % 1000) * 1000 * 1000; in mpp_timer_thread()
261 RK_S32 fd_cnt = epoll_wait(impl->epoll_fd, &events, 1, 500); in mpp_timer_thread()
267 impl->func(impl->ctx); in mpp_timer_thread()
278 MppTimerImpl *impl = NULL; in mpp_timer_get() local
283 impl = mpp_calloc(MppTimerImpl, 1); in mpp_timer_get()
284 if (NULL == impl) { in mpp_timer_get()
304 impl->timer_fd = timer_fd; in mpp_timer_get()
305 impl->epoll_fd = epoll_fd; in mpp_timer_get()
307 impl->initial = 1000; in mpp_timer_get()
308 impl->interval = 1000; in mpp_timer_get()
309 impl->check = timer_name; in mpp_timer_get()
310 snprintf(impl->name, sizeof(impl->name) - 1, name, NULL); in mpp_timer_get()
312 return impl; in mpp_timer_get()
317 if (impl) { in mpp_timer_get()
318 mpp_free(impl); in mpp_timer_get()
319 impl = NULL; in mpp_timer_get()
347 MppTimerImpl *impl = (MppTimerImpl *)timer; in mpp_timer_set_callback() local
348 impl->func = func; in mpp_timer_set_callback()
349 impl->ctx = ctx; in mpp_timer_set_callback()
359 MppTimerImpl *impl = (MppTimerImpl *)timer; in mpp_timer_set_timing() local
360 impl->initial = initial; in mpp_timer_set_timing()
361 impl->interval = interval; in mpp_timer_set_timing()
371 MppTimerImpl *impl = (MppTimerImpl *)timer; in mpp_timer_set_enable() local
373 if (NULL == impl->func || impl->initial < 0 || impl->interval < 0) { in mpp_timer_set_enable()
375 impl->func, impl->initial, impl->interval); in mpp_timer_set_enable()
380 if (!impl->enabled && NULL == impl->thd) { in mpp_timer_set_enable()
381 MppThread *thd = new MppThread(mpp_timer_thread, impl, impl->name); in mpp_timer_set_enable()
383 impl->thd = thd; in mpp_timer_set_enable()
384 impl->enabled = 1; in mpp_timer_set_enable()
389 if (impl->enabled && impl->thd) { in mpp_timer_set_enable()
390 impl->thd->stop(); in mpp_timer_set_enable()
391 impl->enabled = 0; in mpp_timer_set_enable()
403 MppTimerImpl *impl = (MppTimerImpl *)timer; in mpp_timer_put() local
405 if (impl->enabled) in mpp_timer_put()
408 if (impl->timer_fd >= 0) { in mpp_timer_put()
409 close(impl->timer_fd); in mpp_timer_put()
410 impl->timer_fd = -1; in mpp_timer_put()
413 if (impl->epoll_fd >= 0) { in mpp_timer_put()
414 close(impl->epoll_fd); in mpp_timer_put()
415 impl->epoll_fd = -1; in mpp_timer_put()
418 if (impl->thd) { in mpp_timer_put()
419 delete impl->thd; in mpp_timer_put()
420 impl->thd = NULL; in mpp_timer_put()
423 if (impl) { in mpp_timer_put()
424 mpp_free(impl); in mpp_timer_put()
425 impl = NULL; in mpp_timer_put()
475 MppStopwatchImpl *impl = mpp_calloc(MppStopwatchImpl, 1); in mpp_stopwatch_get() local
478 if (impl && nodes) { in mpp_stopwatch_get()
479 impl->check = stopwatch_name; in mpp_stopwatch_get()
480 snprintf(impl->name, sizeof(impl->name) - 1, name, NULL); in mpp_stopwatch_get()
481 impl->nodes = nodes; in mpp_stopwatch_get()
482 impl->max_count = 8; in mpp_stopwatch_get()
485 MPP_FREE(impl); in mpp_stopwatch_get()
489 return impl; in mpp_stopwatch_get()
499 MppStopwatchImpl *impl = (MppStopwatchImpl *)stopwatch; in mpp_stopwatch_set_show_on_exit() local
500 impl->show_on_exit = show_on_exit; in mpp_stopwatch_set_show_on_exit()
514 MppStopwatchImpl *impl = (MppStopwatchImpl *)stopwatch; in mpp_stopwatch_record() local
515 if (impl->filled_count >= impl->max_count) { in mpp_stopwatch_record()
516 RK_S32 max_count = impl->max_count * 2; in mpp_stopwatch_record()
517 MppStopwatchNode *nodes = mpp_realloc(impl->nodes, MppStopwatchNode, in mpp_stopwatch_record()
520 impl->nodes = nodes; in mpp_stopwatch_record()
521 impl->max_count = max_count; in mpp_stopwatch_record()
525 if (impl->filled_count < impl->max_count) { in mpp_stopwatch_record()
526 MppStopwatchNode *node = impl->nodes + impl->filled_count; in mpp_stopwatch_record()
532 if (len > impl->log_len) in mpp_stopwatch_record()
533 impl->log_len = len; in mpp_stopwatch_record()
535 impl->filled_count++; in mpp_stopwatch_record()
546 MppStopwatchImpl *impl = (MppStopwatchImpl *)stopwatch; in mpp_stopwatch_put() local
547 if (impl->show_on_exit && impl->nodes && impl->filled_count) { in mpp_stopwatch_put()
548 MppStopwatchNode *node = impl->nodes; in mpp_stopwatch_put()
553 snprintf(fmt, sizeof(fmt) - 1, "%%s %%-%ds: %%6.2f\n", impl->log_len); in mpp_stopwatch_put()
556 for (i = 1; i < impl->filled_count; i++) { in mpp_stopwatch_put()
557 mpp_log(fmt, impl->name, node->event, in mpp_stopwatch_put()
563 MPP_FREE(impl->nodes); in mpp_stopwatch_put()
564 MPP_FREE(impl); in mpp_stopwatch_put()
574 MppStopwatchImpl *impl = (MppStopwatchImpl *)stopwatch; in mpp_stopwatch_elapsed_time() local
575 if (impl->filled_count < 2) in mpp_stopwatch_elapsed_time()
578 RK_S64 base_time = impl->nodes[0].time; in mpp_stopwatch_elapsed_time()
579 RK_S64 curr_time = impl->nodes[impl->filled_count - 1].time; in mpp_stopwatch_elapsed_time()