Beispiel #1
0
void oprofile_create_files(struct super_block * sb, struct dentry * root)
{
    oprofilefs_create_file(sb, root, "enable", &enable_fops);
    oprofilefs_create_file_perm(sb, root, "dump", &dump_fops, 0666);
    oprofilefs_create_file(sb, root, "buffer", &event_buffer_fops);
    oprofilefs_create_ulong(sb, root, "buffer_size", &fs_buffer_size);
    oprofilefs_create_ulong(sb, root, "buffer_watershed", &fs_buffer_watershed);
    oprofilefs_create_ulong(sb, root, "cpu_buffer_size", &fs_cpu_buffer_size);
    oprofilefs_create_file(sb, root, "cpu_type", &cpu_type_fops); 
    oprofilefs_create_file(sb, root, "backtrace_depth", &depth_fops);
    oprofilefs_create_file(sb, root, "pointer_size", &pointer_size_fops);
    oprofile_create_stats_files(sb, root);
    if (oprofile_ops.create_files)
        oprofile_ops.create_files(sb, root);
}
Beispiel #2
0
void oprofile_create_files(struct super_block *sb, struct dentry *root)
{
	/* reinitialize default values */
	oprofile_buffer_size =		BUFFER_SIZE_DEFAULT;
	oprofile_cpu_buffer_size =	CPU_BUFFER_SIZE_DEFAULT;
	oprofile_buffer_watershed =	BUFFER_WATERSHED_DEFAULT;
	oprofile_time_slice =		msecs_to_jiffies(TIME_SLICE_DEFAULT);

	oprofilefs_create_file(sb, root, "enable", &enable_fops);
	oprofilefs_create_file_perm(sb, root, "dump", &dump_fops, 0666);
	oprofilefs_create_file(sb, root, "buffer", &event_buffer_fops);
	oprofilefs_create_ulong(sb, root, "buffer_size", &oprofile_buffer_size);
	oprofilefs_create_ulong(sb, root, "buffer_watershed", &oprofile_buffer_watershed);
	oprofilefs_create_ulong(sb, root, "cpu_buffer_size", &oprofile_cpu_buffer_size);
	oprofilefs_create_file(sb, root, "cpu_type", &cpu_type_fops);
	oprofilefs_create_file(sb, root, "backtrace_depth", &depth_fops);
	oprofilefs_create_file(sb, root, "pointer_size", &pointer_size_fops);
#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
	oprofilefs_create_file(sb, root, "time_slice", &timeout_fops);
#endif
	oprofilefs_create_file(sb, root, "enhanced_backtrace", 
					&enhanced_backtrace_fops);
	oprofile_create_stats_files(sb, root);
	if (oprofile_ops.create_files)
		oprofile_ops.create_files(sb, root);
}
Beispiel #3
0
static int sh7750_perf_counter_create_files(struct super_block *sb, struct dentry *root)
{
	int i;

	for (i = 0; i < NR_CNTRS; i++) {
		struct dentry *dir;
		char buf[4];

		snprintf(buf, sizeof(buf), "%d", i);
		dir = oprofilefs_mkdir(sb, root, buf);

		oprofilefs_create_ulong(sb, dir, "enabled", &ctr[i].enabled);
		oprofilefs_create_ulong(sb, dir, "event", &ctr[i].event);
		oprofilefs_create_file(sb, dir, "count", &count_fops);

		/* Dummy entries */
		oprofilefs_create_ulong(sb, dir, "kernel", &ctr[i].kernel);
		oprofilefs_create_ulong(sb, dir, "user", &ctr[i].user);
		oprofilefs_create_ulong(sb, dir, "unit_mask", &ctr[i].unit_mask);
	}

	return 0;
}
Beispiel #4
0
static int oprofile_create_hwsampling_files(struct super_block *sb,
						struct dentry *root)
{
	struct dentry *hw_dir;

	/* reinitialize default values */
	hwsampler_file = 1;

	hw_dir = oprofilefs_mkdir(sb, root, "hwsampling");
	if (!hw_dir)
		return -EINVAL;

	oprofilefs_create_file(sb, hw_dir, "hwsampler", &hwsampler_fops);
	oprofilefs_create_ulong(sb, hw_dir, "hw_interval",
				&oprofile_hw_interval);
	oprofilefs_create_ro_ulong(sb, hw_dir, "hw_min_interval",
				&oprofile_min_interval);
	oprofilefs_create_ro_ulong(sb, hw_dir, "hw_max_interval",
				&oprofile_max_interval);
	oprofilefs_create_ulong(sb, hw_dir, "hw_sdbt_blocks",
				&oprofile_sdbt_blocks);

	return 0;
}
Beispiel #5
0
static int oprofile_create_hwsampling_files(struct dentry *root)
{
	struct dentry *dir;

	dir = oprofilefs_mkdir(root, "timer");
	if (!dir)
		return -EINVAL;

	oprofilefs_create_file(dir, "enabled", &timer_enabled_fops);

	if (!hwsampler_available)
		return 0;

	/* reinitialize default values */
	hwsampler_enabled = 1;
	counter_config.kernel = 1;
	counter_config.user = 1;

	if (!force_cpu_type) {
		/*
		 * Create the counter file system.  A single virtual
		 * counter is created which can be used to
		 * enable/disable hardware sampling dynamically from
		 * user space.  The user space will configure a single
		 * counter with a single event.  The value of 'event'
		 * and 'unit_mask' are not evaluated by the kernel code
		 * and can only be set to 0.
		 */

		dir = oprofilefs_mkdir(root, "0");
		if (!dir)
			return -EINVAL;

		oprofilefs_create_file(dir, "enabled", &hwsampler_fops);
		oprofilefs_create_file(dir, "event", &zero_fops);
		oprofilefs_create_file(dir, "count", &hw_interval_fops);
		oprofilefs_create_file(dir, "unit_mask", &zero_fops);
		oprofilefs_create_file(dir, "kernel", &kernel_fops);
		oprofilefs_create_file(dir, "user", &user_fops);
		oprofilefs_create_ulong(dir, "hw_sdbt_blocks",
					&oprofile_sdbt_blocks);

	} else {
		/*
		 * Hardware sampling can be used but the cpu_type is
		 * forced to timer in order to deal with legacy user
		 * space tools.  The /dev/oprofile/hwsampling fs is
		 * provided in that case.
		 */
		dir = oprofilefs_mkdir(root, "hwsampling");
		if (!dir)
			return -EINVAL;

		oprofilefs_create_file(dir, "hwsampler",
				       &hwsampler_fops);
		oprofilefs_create_file(dir, "hw_interval",
				       &hw_interval_fops);
		oprofilefs_create_ro_ulong(dir, "hw_min_interval",
					   &oprofile_min_interval);
		oprofilefs_create_ro_ulong(dir, "hw_max_interval",
					   &oprofile_max_interval);
		oprofilefs_create_ulong(dir, "hw_sdbt_blocks",
					&oprofile_sdbt_blocks);
	}
	return 0;
}