コード例 #1
0
ファイル: seqio_util.c プロジェクト: Degot/lsm-trie-release
  void *
rw4k_thread(void *p)
{
  struct RR *rr = (typeof(rr))p;
  uint8_t * const buf = alloc_buf(rr);
  uint64_t cap = 0;
  ioctl(rr->fd, BLKGETSIZE64, &cap);
  if (cap == 0) {
    cap = lseek(rr->fd, 0, SEEK_END);
  }
  assert(cap);
  cap = (rr->perc * (double)cap);
  setup_affinity(rr);
  const uint64_t start = debug_time_usec();
  const uint64_t dur = rr->duration_sec * 1000000;
  uint64_t count = 0;
  const uint64_t round = 10;
  for (;;) {
    for (uint64_t i = 0; i < round; i++) {
      do_random_rw(rr->fd, rr->mask, buf, rr->write, cap);
    }
    count += round;
    if (debug_time_usec() - start > dur) break;
  }
  // record
  rr->nr_io = count;
  free(buf);
  pthread_exit(NULL);
}
コード例 #2
0
/*
 * Called when affinity is set via /proc/irq
 */
int irq_select_affinity_usr(unsigned int irq, struct cpumask *mask)
{
	struct irq_desc *desc = irq_to_desc(irq);
	unsigned long flags;
	int ret;

	raw_spin_lock_irqsave(&desc->lock, flags);
	ret = setup_affinity(irq, desc, mask);
	raw_spin_unlock_irqrestore(&desc->lock, flags);
	return ret;
}
コード例 #3
0
/*
 * Called when affinity is set via /proc/irq
 */
int irq_select_affinity_usr(unsigned int irq)
{
	struct irq_desc *desc = irq_to_desc(irq);
	unsigned long flags;
	int ret;

	raw_spin_lock_irqsave(&desc->lock, flags);
	ret = setup_affinity(irq, desc);
	if (!ret)
		irq_set_thread_affinity(desc);
	raw_spin_unlock_irqrestore(&desc->lock, flags);

	return ret;
}