您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ timer_stats_account_hrtimer函数代码示例

51自学网 2021-06-03 08:51:35
  C++
这篇教程C++ timer_stats_account_hrtimer函数代码示例写得很实用,希望能帮到您。

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

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

示例1: __run_hrtimer

static void __run_hrtimer(struct hrtimer *timer){	struct hrtimer_clock_base *base = timer->base;	struct hrtimer_cpu_base *cpu_base = base->cpu_base;	enum hrtimer_restart (*fn)(struct hrtimer *);	int restart;	WARN_ON(!irqs_disabled());	debug_hrtimer_deactivate(timer);	__remove_hrtimer(timer, base, HRTIMER_STATE_CALLBACK, 0);	timer_stats_account_hrtimer(timer);	fn = timer->function;	/*	 * Because we run timers from hardirq context, there is no chance	 * they get migrated to another cpu, therefore its safe to unlock	 * the timer base.	 */	spin_unlock(&cpu_base->lock);	restart = fn(timer);	spin_lock(&cpu_base->lock);	/*	 * Note: We clear the CALLBACK bit after enqueue_hrtimer and	 * we do not reprogramm the event hardware. Happens either in	 * hrtimer_start_range_ns() or in hrtimer_interrupt()	 */	if (restart != HRTIMER_NORESTART) {		BUG_ON(timer->state != HRTIMER_STATE_CALLBACK);		enqueue_hrtimer(timer, base);	}	timer->state &= ~HRTIMER_STATE_CALLBACK;}
开发者ID:AppEngine,项目名称:linux-2.6,代码行数:34,


示例2: run_hrtimer_pending

static void run_hrtimer_pending(struct hrtimer_cpu_base *cpu_base){	spin_lock_irq(&cpu_base->lock);	while (!list_empty(&cpu_base->cb_pending)) {		enum hrtimer_restart (*fn)(struct hrtimer *);		struct hrtimer *timer;		int restart;		timer = list_entry(cpu_base->cb_pending.next,				   struct hrtimer, cb_entry);		debug_hrtimer_deactivate(timer);		timer_stats_account_hrtimer(timer);		fn = timer->function;		__remove_hrtimer(timer, timer->base, HRTIMER_STATE_CALLBACK, 0);		spin_unlock_irq(&cpu_base->lock);		restart = fn(timer);		spin_lock_irq(&cpu_base->lock);		timer->state &= ~HRTIMER_STATE_CALLBACK;		if (restart == HRTIMER_RESTART) {			BUG_ON(hrtimer_active(timer));			/*			 * Enqueue the timer, allow reprogramming of the event			 * device			 */			enqueue_hrtimer(timer, timer->base, 1);		} else if (hrtimer_active(timer)) {			/*			 * If the timer was rearmed on another CPU, reprogram			 * the event device.			 */			struct hrtimer_clock_base *base = timer->base;			if (base->first == &timer->node &&			    hrtimer_reprogram(timer, base)) {				/*				 * Timer is expired. Thus move it from tree to				 * pending list again.				 */				__remove_hrtimer(timer, base,						 HRTIMER_STATE_PENDING, 0);				list_add_tail(&timer->cb_entry,					      &base->cpu_base->cb_pending);			}		}	}	spin_unlock_irq(&cpu_base->lock);}
开发者ID:miettal,项目名称:armadillo420_standard,代码行数:53,


示例3: __run_hrtimer

static void __run_hrtimer(struct hrtimer *timer, ktime_t *now){	struct hrtimer_clock_base *base = timer->base;	struct hrtimer_cpu_base *cpu_base = base->cpu_base;	enum hrtimer_restart (*fn)(struct hrtimer *);	int restart;	WARN_ON(!irqs_disabled());	debug_deactivate(timer);	__remove_hrtimer(timer, base, HRTIMER_STATE_CALLBACK, 0);	timer_stats_account_hrtimer(timer);	fn = timer->function;	/*	 * Because we run timers from hardirq context, there is no chance	 * they get migrated to another cpu, therefore its safe to unlock	 * the timer base.	 */	raw_spin_unlock(&cpu_base->lock);	trace_hrtimer_expire_entry(timer, now);#ifdef CONFIG_SEC_DEBUG	secdbg_msg("hrtimer %pS entry", fn);#endif	restart = fn(timer);#ifdef CONFIG_SEC_DEBUG	secdbg_msg("hrtimer %pS exit", fn);#endif	trace_hrtimer_expire_exit(timer);	raw_spin_lock(&cpu_base->lock);	/*	 * Note: We clear the CALLBACK bit after enqueue_hrtimer and	 * we do not reprogramm the event hardware. Happens either in	 * hrtimer_start_range_ns() or in hrtimer_interrupt()	 *	 * Note: Because we dropped the cpu_base->lock above,	 * hrtimer_start_range_ns() can have popped in and enqueued the timer	 * for us already.	 */	if (restart != HRTIMER_NORESTART &&	    !(timer->state & HRTIMER_STATE_ENQUEUED))		enqueue_hrtimer(timer, base);	WARN_ON_ONCE(!(timer->state & HRTIMER_STATE_CALLBACK));	timer->state &= ~HRTIMER_STATE_CALLBACK;}
开发者ID:civato,项目名称:sm-n9005-Note5port-kernel,代码行数:48,


示例4: run_hrtimer_queue

/* * Expire the per base hrtimer-queue: */static inline void run_hrtimer_queue(struct hrtimer_cpu_base *cpu_base,				     int index){	struct rb_node *node;	struct hrtimer_clock_base *base = &cpu_base->clock_base[index];	if (!base->first)		return;	if (base->get_softirq_time)		base->softirq_time = base->get_softirq_time();	spin_lock_irq(&cpu_base->lock);	while ((node = base->first)) {		struct hrtimer *timer;		enum hrtimer_restart (*fn)(struct hrtimer *);		int restart;		timer = rb_entry(node, struct hrtimer, node);		if (base->softirq_time.tv64 <= timer->expires.tv64)			break;#ifdef CONFIG_HIGH_RES_TIMERS		WARN_ON_ONCE(timer->cb_mode == HRTIMER_CB_IRQSAFE_NO_SOFTIRQ);#endif		timer_stats_account_hrtimer(timer);		fn = timer->function;		__remove_hrtimer(timer, base, HRTIMER_STATE_CALLBACK, 0);		spin_unlock_irq(&cpu_base->lock);		restart = fn(timer);		spin_lock_irq(&cpu_base->lock);		timer->state &= ~HRTIMER_STATE_CALLBACK;		if (restart != HRTIMER_NORESTART) {			BUG_ON(hrtimer_active(timer));			enqueue_hrtimer(timer, base, 0);		}	}	spin_unlock_irq(&cpu_base->lock);}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:47,


示例5: run_hrtimer_softirq

static void run_hrtimer_softirq(struct softirq_action *h){	struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);	spin_lock_irq(&cpu_base->lock);	while (!list_empty(&cpu_base->cb_pending)) {		enum hrtimer_restart (*fn)(struct hrtimer *);		struct hrtimer *timer;		int restart;		timer = list_entry(cpu_base->cb_pending.next,				   struct hrtimer, cb_entry);		timer_stats_account_hrtimer(timer);		fn = timer->function;		__remove_hrtimer(timer, timer->base, HRTIMER_STATE_CALLBACK, 0);		spin_unlock_irq(&cpu_base->lock);		restart = fn(timer);		spin_lock_irq(&cpu_base->lock);		timer->state &= ~HRTIMER_STATE_CALLBACK;		if (restart == HRTIMER_RESTART) {			BUG_ON(hrtimer_active(timer));			/*			 * Enqueue the timer, allow reprogramming of the event			 * device			 */			enqueue_hrtimer(timer, timer->base, 1);		} else if (hrtimer_active(timer)) {			/*			 * If the timer was rearmed on another CPU, reprogram			 * the event device.			 */			if (timer->base->first == &timer->node)				hrtimer_reprogram(timer, timer->base);		}	}	spin_unlock_irq(&cpu_base->lock);}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:43,


示例6: __run_hrtimer

static void __run_hrtimer(struct hrtimer *timer){	struct hrtimer_clock_base *base = timer->base;	struct hrtimer_cpu_base *cpu_base = base->cpu_base;	enum hrtimer_restart (*fn)(struct hrtimer *);	int restart;	debug_hrtimer_deactivate(timer);	__remove_hrtimer(timer, base, HRTIMER_STATE_CALLBACK, 0);	timer_stats_account_hrtimer(timer);	fn = timer->function;	if (timer->cb_mode == HRTIMER_CB_IRQSAFE_PERCPU ||	    timer->cb_mode == HRTIMER_CB_IRQSAFE_UNLOCKED) {		/*		 * Used for scheduler timers, avoid lock inversion with		 * rq->lock and tasklist_lock.		 *		 * These timers are required to deal with enqueue expiry		 * themselves and are not allowed to migrate.		 */		spin_unlock(&cpu_base->lock);		restart = fn(timer);		spin_lock(&cpu_base->lock);	} else		restart = fn(timer);	/*	 * Note: We clear the CALLBACK bit after enqueue_hrtimer to avoid	 * reprogramming of the event hardware. This happens at the end of this	 * function anyway.	 */	if (restart != HRTIMER_NORESTART) {		BUG_ON(timer->state != HRTIMER_STATE_CALLBACK);		enqueue_hrtimer(timer, base, 0);	}	timer->state &= ~HRTIMER_STATE_CALLBACK;}
开发者ID:kizukukoto,项目名称:WDN900_GPL,代码行数:38,


示例7: __run_hrtimer

static void __run_hrtimer(struct hrtimer_cpu_base *cpu_base,			  struct hrtimer_clock_base *base,			  struct hrtimer *timer, ktime_t *now){	enum hrtimer_restart (*fn)(struct hrtimer *);	int restart;	lockdep_assert_held(&cpu_base->lock);	debug_deactivate(timer);	cpu_base->running = timer;	/*	 * Separate the ->running assignment from the ->state assignment.	 *	 * As with a regular write barrier, this ensures the read side in	 * hrtimer_active() cannot observe cpu_base->running == NULL &&	 * timer->state == INACTIVE.	 */	raw_write_seqcount_barrier(&cpu_base->seq);	__remove_hrtimer(timer, base, HRTIMER_STATE_INACTIVE, 0);	timer_stats_account_hrtimer(timer);	fn = timer->function;	/*	 * Clear the 'is relative' flag for the TIME_LOW_RES case. If the	 * timer is restarted with a period then it becomes an absolute	 * timer. If its not restarted it does not matter.	 */	if (IS_ENABLED(CONFIG_TIME_LOW_RES))		timer->is_rel = false;	/*	 * Because we run timers from hardirq context, there is no chance	 * they get migrated to another cpu, therefore its safe to unlock	 * the timer base.	 */	raw_spin_unlock(&cpu_base->lock);	trace_hrtimer_expire_entry(timer, now);	restart = fn(timer);	trace_hrtimer_expire_exit(timer);	raw_spin_lock(&cpu_base->lock);	/*	 * Note: We clear the running state after enqueue_hrtimer and	 * we do not reprogramm the event hardware. Happens either in	 * hrtimer_start_range_ns() or in hrtimer_interrupt()	 *	 * Note: Because we dropped the cpu_base->lock above,	 * hrtimer_start_range_ns() can have popped in and enqueued the timer	 * for us already.	 */	if (restart != HRTIMER_NORESTART &&	    !(timer->state & HRTIMER_STATE_ENQUEUED))		enqueue_hrtimer(timer, base);	/*	 * Separate the ->running assignment from the ->state assignment.	 *	 * As with a regular write barrier, this ensures the read side in	 * hrtimer_active() cannot observe cpu_base->running == NULL &&	 * timer->state == INACTIVE.	 */	raw_write_seqcount_barrier(&cpu_base->seq);	WARN_ON_ONCE(cpu_base->running != timer);	cpu_base->running = NULL;}
开发者ID:AK101111,项目名称:linux,代码行数:69,


示例8: hrtimer_interrupt

/* * High resolution timer interrupt * Called with interrupts disabled */void hrtimer_interrupt(struct clock_event_device *dev){	struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);	struct hrtimer_clock_base *base;	ktime_t expires_next, now;	int i, raise = 0;	BUG_ON(!cpu_base->hres_active);	cpu_base->nr_events++;	dev->next_event.tv64 = KTIME_MAX; retry:	now = ktime_get();	expires_next.tv64 = KTIME_MAX;	base = cpu_base->clock_base;	for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) {		ktime_t basenow;		struct rb_node *node;		spin_lock(&cpu_base->lock);		basenow = ktime_add(now, base->offset);		while ((node = base->first)) {			struct hrtimer *timer;			timer = rb_entry(node, struct hrtimer, node);			if (basenow.tv64 < timer->expires.tv64) {				ktime_t expires;				expires = ktime_sub(timer->expires,						    base->offset);				if (expires.tv64 < expires_next.tv64)					expires_next = expires;				break;			}			/* Move softirq callbacks to the pending list */			if (timer->cb_mode == HRTIMER_CB_SOFTIRQ) {				__remove_hrtimer(timer, base,						 HRTIMER_STATE_PENDING, 0);				list_add_tail(&timer->cb_entry,					      &base->cpu_base->cb_pending);				raise = 1;				continue;			}			__remove_hrtimer(timer, base,					 HRTIMER_STATE_CALLBACK, 0);			timer_stats_account_hrtimer(timer);			/*			 * Note: We clear the CALLBACK bit after			 * enqueue_hrtimer to avoid reprogramming of			 * the event hardware. This happens at the end			 * of this function anyway.			 */			if (timer->function(timer) != HRTIMER_NORESTART) {				BUG_ON(timer->state != HRTIMER_STATE_CALLBACK);				enqueue_hrtimer(timer, base, 0);			}			timer->state &= ~HRTIMER_STATE_CALLBACK;		}		spin_unlock(&cpu_base->lock);		base++;	}	cpu_base->expires_next = expires_next;	/* Reprogramming necessary ? */	if (expires_next.tv64 != KTIME_MAX) {		if (tick_program_event(expires_next, 0))			goto retry;	}	/* Raise softirq ? */	if (raise)		raise_softirq(HRTIMER_SOFTIRQ);}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:87,


示例9: run_hrtimer_pending

static void run_hrtimer_pending(struct hrtimer_cpu_base *cpu_base){	spin_lock_irq(&cpu_base->lock);	while (!list_empty(&cpu_base->cb_pending)) {		enum hrtimer_restart (*fn)(struct hrtimer *);		struct hrtimer *timer;		int restart;		int emulate_hardirq_ctx = 0;		timer = list_entry(cpu_base->cb_pending.next,				   struct hrtimer, cb_entry);		debug_hrtimer_deactivate(timer);		timer_stats_account_hrtimer(timer);		fn = timer->function;		/*		 * A timer might have been added to the cb_pending list		 * when it was migrated during a cpu-offline operation.		 * Emulate hardirq context for such timers.		 */		if (timer->cb_mode == HRTIMER_CB_IRQSAFE_PERCPU ||		    timer->cb_mode == HRTIMER_CB_IRQSAFE_UNLOCKED)			emulate_hardirq_ctx = 1;		__remove_hrtimer(timer, timer->base, HRTIMER_STATE_CALLBACK, 0);		spin_unlock_irq(&cpu_base->lock);		if (unlikely(emulate_hardirq_ctx)) {			local_irq_disable();			restart = fn(timer);			local_irq_enable();		} else			restart = fn(timer);		spin_lock_irq(&cpu_base->lock);		timer->state &= ~HRTIMER_STATE_CALLBACK;		if (restart == HRTIMER_RESTART) {			BUG_ON(hrtimer_active(timer));			/*			 * Enqueue the timer, allow reprogramming of the event			 * device			 */			enqueue_hrtimer(timer, timer->base, 1);		} else if (hrtimer_active(timer)) {			/*			 * If the timer was rearmed on another CPU, reprogram			 * the event device.			 */			struct hrtimer_clock_base *base = timer->base;			if (base->first == &timer->node &&			    hrtimer_reprogram(timer, base)) {				/*				 * Timer is expired. Thus move it from tree to				 * pending list again.				 */				__remove_hrtimer(timer, base,						 HRTIMER_STATE_PENDING, 0);				list_add_tail(&timer->cb_entry,					      &base->cpu_base->cb_pending);			}		}	}	spin_unlock_irq(&cpu_base->lock);}
开发者ID:kizukukoto,项目名称:WDN900_GPL,代码行数:68,



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


C++ timer_stats_hrtimer_clear_start_info函数代码示例
C++ timer_start函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。