Пример #1
0
void
close_output()
{
    pmu_stop();
    pmu_fini();
    if (outfile)
        fclose(outfile);
}
Пример #2
0
static int
syf_pwm_ioctl(struct inode *inode, struct file *file,
              unsigned int cmd, void *arg)
{
    int i;
    unsigned int freq;
    cpu_ctrl_t *cc				= (cpu_ctrl_t *) arg;
    pmu_results_t *r 			= &(cc->pmu);
    unsigned int amt_cpu 		= cc->amt_cpu;
    unsigned int amt_counter 	= cc->amt_counter;

    for (i = 0; i < amt_cpu; ++i) {
        struct syf_info_t *_sinfo = &per_cpu(_syf_info, i);

        switch (cmd) {
        case SYFPWM_TESTING:
            printk("TESTING.\n");
            break;

        case SYFPWM_PMU_START:
            pmu_start(amt_counter, cc->evt_t);
            break;

        case SYFPWM_PMU_STOP:
            pmu_stop(amt_counter);
            memcpy(r, &pmu, sizeof(pmu_results_t));
            break;

        case SYFPWM_GET_FEQU:
            mutex_lock(&_syf_mutex);
            cpufreq_get_policy(&_sinfo->cur_policy, i);
            freq = cpufreq_get(_sinfo->cur_policy.cpu);
            mutex_unlock(&_syf_mutex);
            break;

        case SYFPWM_SET_FEQU:
            mutex_lock(&_syf_mutex);
            cpufreq_get_policy(&_sinfo->cur_policy, i);
            freq = __cpufreq_driver_target(&_sinfo->cur_policy,
                                           (unsigned int) cc->cpu_freq,
                                           CPUFREQ_RELATION_H);
            mutex_unlock(&_syf_mutex);
            break;
        }
    }

    return 0;
}
Пример #3
0
static int pmu_suspend(struct sys_device *dev, u32 state)
{
	if (pmu_enabled)
		pmu_stop();
	return 0;
}
Пример #4
0
static int pmu_suspend(struct sys_device *dev, pm_message_t state)
{
    if (pmu_enabled)
        pmu_stop();
    return 0;
}
Пример #5
0
int do_experiment(struct list *list, char *store_name, unsigned long rec_num, 
			unsigned long rec_size, int op)
{
	struct timespec stamp_s, stamp_e;
	unsigned long tv_sec, tv_nsec;
	struct node *node;
	unsigned long long tmp_key[2];
	unsigned long long *tmp_value;
	DBT key, value;
	unsigned long cnt, i;
	int rval;

	tmp_value = (unsigned long long *)malloc(rec_size);
	node = list->head;
	cnt = 1;
	
	memset(&key, 0, sizeof(DBT));
	memset(&value, 0, sizeof(DBT));

	key.data = tmp_key;
	key.size = 16;
	value.data = tmp_value;
	value.size = rec_size;
	value.ulen = rec_size;
	value.flags = DB_DBT_USERMEM;

	clock_gettime(CLOCK_REALTIME, &stamp_s);
	pmu_start();
	while (node) {

		tmp_key[0] = tmp_key[1] = node->key;
		
		switch (op) {
			case INSERT:
				for (i=0; i<rec_size/8; i++) {
					tmp_value[i] = rec_num + node->key;
				}
				if (db->put(db, NULL, &key, &value, DB_NOOVERWRITE) != 0) {
					printf("[BDB] db->put() fail");
					return 0;
				}
				break;
				
			case LOOKUP:
				if (db->get(db, NULL, &key, &value, 0) != 0) {
					printf("[BDB] db->get() fail\n");
					return 0;
				} //else {
				//	tmp_value = (unsigned long *)value.data;
				//	if (tmp_value[0] != rec_num + node->key) {
				//		printf("[BDB] db->get(), wrong value!\n");
				//		return 0;
				//	}
				//}
				break;
				
			case DELETE:
				if (db->del(db, NULL, &key, 0) != 0) {
					printf("[BDB] db->del() fail\n");
					return 0;
				}
				break;

			case UPDATE:
				if (cnt%(FREQ_NUM+1) == 0) {
					if (db->del(db, NULL, &key, 0) != 0) {
						printf("[BDB] update: db->del() fail\n");
						return 0;
					}
				} else {
					for (i=0; i<rec_size/8; i++) {
						tmp_value[i] = rec_num + node->key;
					}
					if (db->put(db, NULL, &key, &value, DB_NOOVERWRITE) != 0) {
						printf("[BDB] update: db->put() fail\n");
						return 0;
					}
				}
				break;
				
			default:
				printf("Wrong operation!\n");
				return 0;
				//break;
		}

		node = node->next;
		cnt++;
		//if (cnt == rec_num)
		//	break;
	}
	pmu_stop();
	clock_gettime(CLOCK_REALTIME, &stamp_e);
	
	tv_sec = stamp_e.tv_sec - stamp_s.tv_sec;
	if (stamp_e.tv_nsec < stamp_s.tv_nsec) {
		stamp_e.tv_nsec += 1000000000;
		tv_sec--;
	}
	tv_nsec = stamp_e.tv_nsec - stamp_s.tv_nsec;
	printf("[BDB] Experiment Time (sec=%lu, nsec=%lu)\n", tv_sec, tv_nsec);

	free(tmp_value);
	return cnt-1;
}