• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ read_counter函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: read_counter

inline void msm5832_device::advance_minutes()
{
	int minutes = read_counter(REGISTER_MI1);
	int hours = read_counter(REGISTER_H1);
	int days = read_counter(REGISTER_D1);
	int month = read_counter(REGISTER_MO1);
	int year = read_counter(REGISTER_Y1);
	int day_of_week = m_reg[REGISTER_W];

	minutes++;

	if (minutes > 59)
	{
		minutes = 0;
		hours++;
	}

	if (hours > 23)
	{
		hours = 0;
		days++;
		day_of_week++;
	}

	if (day_of_week > 6)
	{
		day_of_week++;
	}

	if (days > DAYS_PER_MONTH[month - 1])
	{
		days = 1;
		month++;
	}

	if (month > 12)
	{
		month = 1;
		year++;
	}

	if (year > 99)
	{
		year = 0;
	}

	write_counter(REGISTER_MI1, minutes);
	write_counter(REGISTER_H1, hours);
	write_counter(REGISTER_D1, days);
	write_counter(REGISTER_MO1, month);
	write_counter(REGISTER_Y1, year);
	m_reg[REGISTER_W] = day_of_week;
}
开发者ID:bdidier,项目名称:MAME-OS-X,代码行数:53,代码来源:msm5832.c


示例2: get_freq

// get CPU frequency in Hz (1MHz precision)
ui64 get_freq(void)
{
    unsigned __int64  x = 0;
    time_t i;
    i = time(NULL);
    while (i == time(NULL));
    x -= read_counter();
    i++;
    while (i == time(NULL));
    x += read_counter();
    return x;
}
开发者ID:jeeb,项目名称:MPGDec,代码行数:13,代码来源:misc.cpp


示例3: main

int main(int argc, char * argv[]) {
//    int m = atoi(argv[1]);
    int m = 9;
	int i;
ui64 c  = read_counter();
for (int k=0; k<10; k++) {
    for (i = 0; i < 3; i++)
        nsieve(10000 << (m-i));
}

	render(read_counter()-c,10);
    return 0;
}
开发者ID:LiaoZhuo,项目名称:Practice,代码行数:13,代码来源:nsieve.cpp


示例4: platform_set_periodic_timer

status_t platform_set_periodic_timer(platform_timer_callback callback, void *arg, lk_time_t interval)
{
    LTRACEF("callback %p, arg %p, interval %lu\n", callback, arg, interval);

    enter_critical_section();

    t_callback = callback;

    /* disable the timer */
    ARM64_WRITE_SYSREG(CNTP_CTL_EL0, 0);

    /* set the countdown register to max */
    ARM64_WRITE_SYSREG(CNTP_TVAL_EL0, INT32_MAX);

    /* calculate the compare delta and set the comparison register */
    interval_delta = (uint64_t)timer_freq * interval / 1000U;
    last_compare = read_counter() + interval_delta;
    ARM64_WRITE_SYSREG(CNTP_CVAL_EL0, last_compare);

    ARM64_WRITE_SYSREG(CNTP_CTL_EL0, 1);

    unmask_interrupt(INT_PPI_NSPHYS_TIMER);

    exit_critical_section();

    return NO_ERROR;
}
开发者ID:M1cha,项目名称:lk,代码行数:27,代码来源:timer.c


示例5: etna_sw_end_query

static void
etna_sw_end_query(struct etna_context *ctx, struct etna_query *q)
{
   struct etna_sw_query *sq = etna_sw_query(q);

   q->active = false;
   sq->end_value = read_counter(ctx, q->type);
}
开发者ID:MIPS,项目名称:external-mesa3d,代码行数:8,代码来源:etnaviv_query_sw.c


示例6: read_timer

ui64 read_timer()
{
    ui64 tmp;

    tmp = local;
    local = read_counter();
    return (local - tmp);
}
开发者ID:jeeb,项目名称:MPGDec,代码行数:8,代码来源:misc.cpp


示例7: fd_sw_end_query

static void
fd_sw_end_query(struct fd_context *ctx, struct fd_query *q)
{
	struct fd_sw_query *sq = fd_sw_query(q);
	sq->end_value = read_counter(ctx, q->type);
	if (is_rate_query(q))
		sq->end_time = os_time_get();
}
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:8,代码来源:freedreno_query_sw.c


示例8: read_cpu_counter

u64 read_cpu_counter(){
	int cpu;
	u64 result = 0;
	for (cpu = 0; cpu < nr_cpus; cpu++){
		result += read_counter(fd[cpu]);
	}

	return result;
}
开发者ID:cupertino,项目名称:ptop,代码行数:9,代码来源:eperf.c


示例9: fd_sw_begin_query

static boolean
fd_sw_begin_query(struct fd_context *ctx, struct fd_query *q)
{
	struct fd_sw_query *sq = fd_sw_query(q);
	sq->begin_value = read_counter(ctx, q->type);
	if (is_rate_query(q))
		sq->begin_time = os_time_get();
   return true;
}
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:9,代码来源:freedreno_query_sw.c


示例10: get_freq

/*
    determine cpu frequency
	not very precise but sufficient
*/
double
get_freq()
{
	int64_t x, y;
	int32_t i;

	i = time(NULL);

	while (i == time(NULL));

	x = read_counter();
	i++;

	while (i == time(NULL));

	y = read_counter();

	return (double) (y - x) / 1000.;
}
开发者ID:DanielGit,项目名称:Intrisit201202,代码行数:23,代码来源:timer.c


示例11: etna_sw_begin_query

static boolean
etna_sw_begin_query(struct etna_context *ctx, struct etna_query *q)
{
   struct etna_sw_query *sq = etna_sw_query(q);

   q->active = true;
   sq->begin_value = read_counter(ctx, q->type);

   return true;
}
开发者ID:MIPS,项目名称:external-mesa3d,代码行数:10,代码来源:etnaviv_query_sw.c


示例12: fd_sw_end_query

static void
fd_sw_end_query(struct fd_context *ctx, struct fd_query *q)
{
	struct fd_sw_query *sq = fd_sw_query(q);
	sq->end_value = read_counter(ctx, q->type);
	if (is_time_rate_query(q)) {
		sq->end_time = os_time_get();
	} else if (is_draw_rate_query(q)) {
		sq->end_time = ctx->stats.draw_calls;
	}
}
开发者ID:ValveSoftware,项目名称:steamos_mesa,代码行数:11,代码来源:freedreno_query_sw.c


示例13: detect_pll_input_clock

/**
 * detect_pll_input_clock - Detect the PLL input clock in Hz.
 * @dma_base: for the port address
 * E.g. 16949000 on 33 MHz PCI bus, i.e. half of the PCI clock.
 */
static long detect_pll_input_clock(unsigned long dma_base)
{
	struct timeval start_time, end_time;
	long start_count, end_count;
	long pll_input, usec_elapsed;
	u8 scr1;

	start_count = read_counter(dma_base);
	do_gettimeofday(&start_time);

	/* Start the test mode */
	outb(0x01, dma_base + 0x01);
	scr1 = inb(dma_base + 0x03);
	DBG("scr1[%02X]\n", scr1);
	outb(scr1 | 0x40, dma_base + 0x03);

	/* Let the counter run for 10 ms. */
	mdelay(10);

	end_count = read_counter(dma_base);
	do_gettimeofday(&end_time);

	/* Stop the test mode */
	outb(0x01, dma_base + 0x01);
	scr1 = inb(dma_base + 0x03);
	DBG("scr1[%02X]\n", scr1);
	outb(scr1 & ~0x40, dma_base + 0x03);

	/*
	 * Calculate the input clock in Hz
	 * (the clock counter is 30 bit wide and counts down)
	 */
	usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 +
		(end_time.tv_usec - start_time.tv_usec);
	pll_input = ((start_count - end_count) & 0x3fffffff) / 10 *
		(10000000 / usec_elapsed);

	DBG("start[%ld] end[%ld]\n", start_count, end_count);

	return pll_input;
}
开发者ID:Epirex,项目名称:Chrono_Kernel-1,代码行数:46,代码来源:pdc202xx_new.c


示例14: fd_sw_begin_query

static boolean
fd_sw_begin_query(struct fd_context *ctx, struct fd_query *q)
{
	struct fd_sw_query *sq = fd_sw_query(q);
	sq->begin_value = read_counter(ctx, q->type);
	if (is_time_rate_query(q)) {
		sq->begin_time = os_time_get();
	} else if (is_draw_rate_query(q)) {
		sq->begin_time = ctx->stats.draw_calls;
	}
	return true;
}
开发者ID:ValveSoftware,项目名称:steamos_mesa,代码行数:12,代码来源:freedreno_query_sw.c


示例15: main

void main(void)
{
	init_io();
	setup_counter();

	usb_init();
	ep0_init();

	while (1) {
		read_counter();
		usb_poll();
	}
}
开发者ID:cfriedt,项目名称:ben-wpan,代码行数:13,代码来源:cntr.c


示例16: read_counters

static void read_counters(bool close_counters)
{
	struct perf_evsel *counter;

	evlist__for_each(evsel_list, counter) {
		if (read_counter(counter))
			pr_debug("failed to read counter %s\n", counter->name);

		if (perf_stat_process_counter(&stat_config, counter))
			pr_warning("failed to process counter %s\n", counter->name);

		if (close_counters) {
			perf_evsel__close_fd(counter, perf_evsel__nr_cpus(counter),
					     thread_map__nr(evsel_list->threads));
		}
	}
}
开发者ID:Chong-Li,项目名称:cse522,代码行数:17,代码来源:builtin-stat.c


示例17: mn103tim_io_read_buffer

static unsigned
mn103tim_io_read_buffer (struct hw *me,
			 void *dest,
			 int space,
			 unsigned_word base,
			 unsigned nr_bytes)
{
  struct mn103tim *timers = hw_data (me);
  enum timer_register_types timer_reg;

  HW_TRACE ((me, "read 0x%08lx %d", (long) base, (int) nr_bytes));

  timer_reg = decode_addr (me, timers, base);

  /* It can be either a mode register, a base register, a binary counter, */
  /* or a special timer 6 register.  Check in that order. */
  if ( timer_reg >= FIRST_MODE_REG && timer_reg <= LAST_MODE_REG )
    {
      read_mode_reg(me, timers, timer_reg-FIRST_MODE_REG, dest, nr_bytes);
    }
  else if ( timer_reg <= LAST_BASE_REG )
    {
      read_base_reg(me, timers, timer_reg-FIRST_BASE_REG, dest, nr_bytes);
    }
  else if ( timer_reg <= LAST_COUNTER )
    {
      read_counter(me, timers, timer_reg-FIRST_COUNTER, dest, nr_bytes);
    }
  else if ( timer_reg <= LAST_TIMER_REG )
    {
      read_special_timer6_reg(me, timers, timer_reg, dest, nr_bytes);
    }
  else
    {
      hw_abort(me, "invalid timer register address.");
    }

  return nr_bytes;
}     
开发者ID:OpenInkpot-archive,项目名称:iplinux-gdb,代码行数:39,代码来源:dv-mn103tim.c


示例18: platform_set_oneshot_timer

status_t platform_set_oneshot_timer (platform_timer_callback callback, void *arg, lk_time_t interval)
{
    LTRACEF("callback %p, arg %p, interval %lu\n", callback, arg, interval);

    enter_critical_section();

    t_callback = callback;

    /* disable the timer */
    ARM64_WRITE_SYSREG(CNTP_CTL_EL0, 0);

    /* set the countdown register to max */
    ARM64_WRITE_SYSREG(CNTP_TVAL_EL0, INT32_MAX);

    /* calculate the interval */
    uint64_t ticks = (uint64_t)timer_freq * interval / 1000U;

    /* set the comparison register */
    uint64_t counter = read_counter();
    counter += ticks;

    LTRACEF("new counter 0x%llx ticks %llu\n", counter, ticks);

    ARM64_WRITE_SYSREG(CNTP_CVAL_EL0, counter);

    /* disable periodic mode */
    interval_delta = 0;

    /* start the timer, unmask irq */
    ARM64_WRITE_SYSREG(CNTP_CTL_EL0, 1);

    unmask_interrupt(INT_PPI_NSPHYS_TIMER);

    exit_critical_section();

    return NO_ERROR;
}
开发者ID:M1cha,项目名称:lk,代码行数:37,代码来源:timer.c


示例19: stop_inter_timer

void
stop_inter_timer()
{
	tim.inter += (read_counter() - tim.current);
}
开发者ID:DanielGit,项目名称:Intrisit201202,代码行数:5,代码来源:timer.c


示例20: current_time

lk_time_t current_time(void)
{
    return read_counter() / msec_ratio;
}
开发者ID:M1cha,项目名称:lk,代码行数:4,代码来源:timer.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ read_cpuid_id函数代码示例发布时间:2022-05-30
下一篇:
C++ read_config_file函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap