Пример #1
0
void print_context_counters() {
  FILE *f = fopen("vp9_context.c", "w");

  fprintf(f, "#include \"vp9_entropy.h\"\n");
  fprintf(f, "\n/* *** GENERATED FILE: DO NOT EDIT *** */\n\n");

  /* print counts */
  print_counter(f, context_counters[TX_4X4], BLOCK_TYPES,
                "vp9_default_coef_counts_4x4[BLOCK_TYPES]");
  print_counter(f, context_counters[TX_8X8], BLOCK_TYPES,
                "vp9_default_coef_counts_8x8[BLOCK_TYPES]");
  print_counter(f, context_counters[TX_16X16], BLOCK_TYPES,
                "vp9_default_coef_counts_16x16[BLOCK_TYPES]");
  print_counter(f, context_counters[TX_32X32], BLOCK_TYPES,
                "vp9_default_coef_counts_32x32[BLOCK_TYPES]");

  /* print coefficient probabilities */
  print_probs(f, context_counters[TX_4X4], BLOCK_TYPES,
              "default_coef_probs_4x4[BLOCK_TYPES]");
  print_probs(f, context_counters[TX_8X8], BLOCK_TYPES,
              "default_coef_probs_8x8[BLOCK_TYPES]");
  print_probs(f, context_counters[TX_16X16], BLOCK_TYPES,
              "default_coef_probs_16x16[BLOCK_TYPES]");
  print_probs(f, context_counters[TX_32X32], BLOCK_TYPES,
              "default_coef_probs_32x32[BLOCK_TYPES]");

  fclose(f);

  f = fopen("context.bin", "wb");
  fwrite(context_counters, sizeof(context_counters), 1, f);
  fclose(f);
}
Пример #2
0
/* dump simulator-specific auxiliary simulator statistics */
void
sim_aux_stats(FILE *stream)		/* output stream */
{
  /* nada */
  print_counter(stream, "sim_elapsed_time", sim_elapsed_time, "simulation time in seconds");
  print_rate(stream, "sim_insn_rate", (double)sim_num_insn/sim_elapsed_time, "simulation speed (insts/sec)");

  print_counter(stream, "sim_num_insn", sim_num_insn, "instructions simulated (fast-forwarding included)");
  print_counter(stream, "sim_sample_insn", sim_sample_insn, "instructions (in sample)");
  print_counter(stream, "sim_sample_int", sim_sample_insn_split[ic_icomp] + sim_sample_insn_split[ic_icomplong], "integer operations");
  print_counter(stream, "sim_sample_load", sim_sample_insn_split[ic_load], "loads");
  print_counter(stream, "sim_sample_store", sim_sample_insn_split[ic_store], "stores");
  print_counter(stream, "sim_sample_branch", sim_sample_insn_split[ic_ctrl], "branches");
  print_counter(stream, "sim_sample_fp", sim_sample_insn_split[ic_fcomp] + sim_sample_insn_split[ic_fcomplong], "floating point operations");
  print_counter(stream, "sim_sample_prefetch", sim_sample_insn_split[ic_prefetch], "prefetches");
  print_counter(stream, "sim_sample_sys", sim_sample_insn_split[ic_sys], "syscalls");

  /* register cache stats */
  if (cache_dl1)
    cache_stats_print(cache_dl1, stream);
  if (dtlb)
    cache_stats_print(dtlb, stream);
  if (cache_il1 && cache_il1 != cache_dl1)
    cache_stats_print(cache_il1, stream);
  if (itlb && itlb != dtlb)
    cache_stats_print(itlb, stream);
  if (cache_l2)
    cache_stats_print(cache_l2, stream);
}
Пример #3
0
int main(int argc, const char *argv[])
{
	FILE *f;
	off_t filesize;
	struct stat sb;
	clock_t start, end;
	int bufn = 100;
	int range = -1;
	int *counter;
	int rc;

	if (argc < 2) {
		fprintf(stderr, "%s <filename> [bufn] [range]\n", argv[0]);
		exit(EXIT_FAILURE);
	}

	f = fopen(argv[1], "rb");
	if (f == NULL) {
		fprintf(stderr, "Failed to open file %s\n", argv[1]);
		return EXIT_FAILURE;
	}

	if (argc > 2) {
		bufn = strtol(argv[2], NULL, 0);
		if (argc == 4)
			range = strtol(argv[3], NULL, 0);
	}

	if (stat(argv[1], &sb)) {
		perror("stat");
		exit(EXIT_FAILURE);
	}

	filesize = sb.st_size;

	if (range < 0) {
		range = find_range(f, bufn);
		if (range < 0) {
			fprintf(stderr, "Failed to get range\n");
			exit(EXIT_FAILURE);
		}
	}

	start = clock();
	rc = counting_sort(f, range, bufn, &counter);
	end = clock();

	if (rc) {
		fprintf(stderr, "Failed to sort  %s\n", argv[0]);
		exit(EXIT_FAILURE);
	}

	print_counter(counter, range);
	
	fprintf(stderr, "%ld bytes sorted in %f seconds\n", filesize, (double)(end - start) / CLOCKS_PER_SEC);

	return EXIT_SUCCESS;
}
Пример #4
0
void MRFI_RxCompleteISR()
{
  mrfiPacket_t packet;
  stop_fast_timeout();
  stop_slow_timeout();
  MRFI_Receive(&packet);
  if (packet.frame[9]<4) {
    print_counter(packet.frame[9]);
    start_slow_timeout();
  } else {
    MRFI_WakeUp();
    MRFI_RxOn();
  }
}
Пример #5
0
int main(int argc, char* argv[])
{
#if ROOKS_MONITOR
	pthread_t t;
#endif
	struct Config c;

	/* Initialisation */
	for (N_INDEX i = 0; i < N; i++) {
		for (N_INDEX j = 0; j < N; j++) {
			c.heights[i][j] = 0;
			c.best_heights[i][j] = 0;
		}
		for (size_t j = 0; j < 2; j++) {
			c.forbidden_x[i][j] = 0;
			c.forbidden_y[i][j] = 0;
			c.forbidden_z[i][j] = 0;
		}
		c.proj_z_x[i] = 0;
		c.proj_z_y[i] = 0;
		c.proj_y_z[i] = 0;
		c.proj_y_x[i] = 0;
		c.proj_x_y[i] = 0;
		c.proj_x_z[i] = 0;
		c.cardinal_x[i] = 0;
	}
	c.proj_x_y[N] = (N_BITFIELD) (-1);
	c.card = 0;
#ifndef R_MIN
	c.best_card = 0;
#else
	c.best_card = R_MIN - 1;
#endif
	c.max_z = 1;


#if ROOKS_MONITOR
	pthread_create(&t, NULL, monitor, &c);
#endif

	Worker<true, true>::backtrack(&c, N-1, N-1);

	print_counter();
	return 0;
}
Пример #6
0
Файл: irq.c Проект: UraKn0x/gbdk
void main()
{
  /* Ensure mutual exclusion (not really necessary in this example)... */
  disable_interrupts();
  vbl_cnt = tim_cnt = 0;
  add_VBL(vbl);
  add_TIM(tim);
  enable_interrupts();

  /* Set TMA to divide clock by 0x100 */
  TMA_REG = 0x00U;
  /* Set clock to 4096 Hertz */
  TAC_REG = 0x04U;
  /* Handle VBL and TIM interrupts */
  set_interrupts(VBL_IFLAG | TIM_IFLAG);

  while(1) {
    print_counter();
    delay(1000UL);
  }
}
Пример #7
0
/*
 * This thread runs indefinitely
 */
void clock_thread(void)
{
    unsigned int time;
    unsigned long long int ticks;
    unsigned int start_time;


    /* To show time since last boot, remove all references to start_time */
    ticks = get_timer() >> 20;  /* divide on 2^20 = 10^6 (1048576) */
    start_time = ((int) ticks) / MHZ;   /* divide on CPU clock frequency in
                                         * megahertz */
    while (1) {
        ticks = get_timer() >> 20;      /* divide on 2^20 = 10^6 (1048576) */
        time = ((int) ticks) / MHZ;     /* divide on CPU clock frequency in
                                         * megahertz */
        print_str(24, 50, "Time (in seconds) : ");
        print_int(24, 70, time - start_time);
        print_counter();
        do_yield();
    }
}