static int gator_events_block_create_files(struct super_block *sb, struct dentry *root) { struct dentry *dir; /* block_complete_wr */ dir = gatorfs_mkdir(sb, root, "Linux_block_rq_wr"); if (!dir) return -1; gatorfs_create_ulong(sb, dir, "enabled", &block_rq_wr_enabled); gatorfs_create_ro_ulong(sb, dir, "key", &block_rq_wr_key); /* block_complete_rd */ dir = gatorfs_mkdir(sb, root, "Linux_block_rq_rd"); if (!dir) return -1; gatorfs_create_ulong(sb, dir, "enabled", &block_rq_rd_enabled); gatorfs_create_ro_ulong(sb, dir, "key", &block_rq_rd_key); return 0; }
static int gator_events_irq_create_files(struct super_block *sb, struct dentry *root) { struct dentry *dir; /* irq */ dir = gatorfs_mkdir(sb, root, "Linux_irq_irq"); if (!dir) { return -1; } gatorfs_create_ulong(sb, dir, "enabled", &hardirq_enabled); gatorfs_create_ro_ulong(sb, dir, "key", &hardirq_key); /* soft irq */ dir = gatorfs_mkdir(sb, root, "Linux_irq_softirq"); if (!dir) { return -1; } gatorfs_create_ulong(sb, dir, "enabled", &softirq_enabled); gatorfs_create_ro_ulong(sb, dir, "key", &softirq_key); return 0; }
static int gator_events_sched_create_files(struct super_block *sb, struct dentry *root) { struct dentry *dir; /* switch */ dir = gatorfs_mkdir(sb, root, "Linux_sched_switch"); if (!dir) return -1; gatorfs_create_ulong(sb, dir, "enabled", &sched_switch_enabled); gatorfs_create_ro_ulong(sb, dir, "key", &sched_switch_key); return 0; }
static int gator_events_meminfo_create_files(struct super_block *sb, struct dentry *root) { struct dentry *dir; int i; for (i = 0; i < MEMINFO_TOTAL; i++) { dir = gatorfs_mkdir(sb, root, meminfo_names[i]); if (!dir) return -1; gatorfs_create_ulong(sb, dir, "enabled", &meminfo_enabled[i]); gatorfs_create_ro_ulong(sb, dir, "key", &meminfo_keys[i]); } for (i = 0; i < PROC_COUNT; ++i) { dir = gatorfs_mkdir(sb, root, proc_names[i]); if (!dir) return -1; gatorfs_create_ulong(sb, dir, "enabled", &proc_enabled[i]); gatorfs_create_ro_ulong(sb, dir, "key", &proc_keys[i]); } return 0; }
extern int gator_mali_create_file_system(const char *mali_name, const char *event_name, struct super_block *sb, struct dentry *root, struct mali_counter *counter, unsigned long *event) { int err; char buf[255]; struct dentry *dir; /* If the counter name is empty ignore it */ if (strlen(event_name) != 0) { /* Set up the filesystem entry for this event. */ if (mali_name == NULL) snprintf(buf, sizeof(buf), "ARM_Mali-%s", event_name); else snprintf(buf, sizeof(buf), "ARM_Mali-%s_%s", mali_name, event_name); dir = gatorfs_mkdir(sb, root, buf); if (dir == NULL) { pr_err("gator: %s: error creating file system for: %s (%s)\n", mali_name, event_name, buf); return -1; } err = gatorfs_create_ulong(sb, dir, "enabled", &counter->enabled); if (err != 0) { pr_err("gator: %s: error calling gatorfs_create_ulong for: %s (%s)\n", mali_name, event_name, buf); return -1; } err = gatorfs_create_ro_ulong(sb, dir, "key", &counter->key); if (err != 0) { pr_err("gator: %s: error calling gatorfs_create_ro_ulong for: %s (%s)\n", mali_name, event_name, buf); return -1; } if (counter->cores != -1) { err = gatorfs_create_ro_ulong(sb, dir, "cores", &counter->cores); if (err != 0) { pr_err("gator: %s: error calling gatorfs_create_ro_ulong for: %s (%s)\n", mali_name, event_name, buf); return -1; } } if (event != NULL) { err = gatorfs_create_ulong(sb, dir, "event", event); if (err != 0) { pr_err("gator: %s: error calling gatorfs_create_ro_ulong for: %s (%s)\n", mali_name, event_name, buf); return -1; } } } return 0; }
/* Adds mmapped_cntX directories and enabled, event, and key files to /dev/gator/events */ static int gator_events_mmapped_create_files(struct super_block *sb, struct dentry *root) { int i; for (i = 0; i < MMAPPED_COUNTERS_NUM; i++) { char buf[16]; struct dentry *dir; snprintf(buf, sizeof(buf), "mmapped_cnt%d", i); dir = gatorfs_mkdir(sb, root, buf); if (WARN_ON(!dir)) return -1; gatorfs_create_ulong(sb, dir, "enabled", &mmapped_counters[i].enabled); gatorfs_create_ro_ulong(sb, dir, "key", &mmapped_counters[i].key); } return 0; }
int gator_events_mali_create_files(struct super_block *sb, struct dentry *root) { struct dentry *dir; int event; int n_fp = gator_mali_get_n_fp(); /* * Create the filesystem entries for vertex processor, fragement processor * and L2 cache timeline and hardware counters. Software counters get * special handling after this block. */ for (event = FIRST_ACTIVITY_EVENT; event <= LAST_HW_COUNTER; event++) { char buf[40]; /* * We can skip this event if it's for a non-existent fragment * processor. */ if (((event - ACTIVITY_FP0 >= n_fp) && (event < COUNTER_L2_C0)) || (((event - COUNTER_FP0_C0)/2 >= n_fp))) { continue; } /* Otherwise, set up the filesystem entry for this event. */ switch (event) { case ACTIVITY_VP: snprintf(buf, sizeof buf, "ARM_%s_VP_active", mali_name); break; case ACTIVITY_FP0: case ACTIVITY_FP1: case ACTIVITY_FP2: case ACTIVITY_FP3: snprintf(buf, sizeof buf, "ARM_%s_FP%d_active", mali_name, event - ACTIVITY_FP0); break; case COUNTER_L2_C0: case COUNTER_L2_C1: snprintf(buf, sizeof buf, "ARM_%s_L2_cnt%d", mali_name, event - COUNTER_L2_C0); break; case COUNTER_VP_C0: case COUNTER_VP_C1: snprintf(buf, sizeof buf, "ARM_%s_VP_cnt%d", mali_name, event - COUNTER_VP_C0); break; case COUNTER_FP0_C0: case COUNTER_FP0_C1: case COUNTER_FP1_C0: case COUNTER_FP1_C1: case COUNTER_FP2_C0: case COUNTER_FP2_C1: case COUNTER_FP3_C0: case COUNTER_FP3_C1: snprintf(buf, sizeof buf, "ARM_%s_FP%d_cnt%d", mali_name, (event - COUNTER_FP0_C0) / 2, (event - COUNTER_FP0_C0) % 2); break; default: printk("gator: trying to create file for non-existent counter (%d)\n", event); continue; } dir = gatorfs_mkdir(sb, root, buf); if (!dir) { return -1; } gatorfs_create_ulong(sb, dir, "enabled", &counter_enabled[event]); /* Only create an event node for counters that can change what they count */ if (event >= COUNTER_L2_C0) { gatorfs_create_ulong(sb, dir, "event", &counter_event[event]); } gatorfs_create_ro_ulong(sb, dir, "key", &counter_key[event]); } /* Now set up the software counter entries */ for (event = FIRST_SW_COUNTER; event <= LAST_SW_COUNTER; event++) { char buf[40]; snprintf(buf, sizeof(buf), "ARM_%s_SW_%d", mali_name, event); dir = gatorfs_mkdir(sb, root, buf); if (!dir) { return -1; } gatorfs_create_ulong(sb, dir, "enabled", &counter_enabled[event]); gatorfs_create_ro_ulong(sb, dir, "key", &counter_key[event]); } /* Now set up the special counter entries */ for (event = FIRST_SPECIAL_COUNTER; event <= LAST_SPECIAL_COUNTER; event++) { char buf[40]; snprintf(buf, sizeof(buf), "ARM_%s_Filmstrip", mali_name); dir = gatorfs_mkdir(sb, root, buf); if (!dir) { return -1; } gatorfs_create_ulong(sb, dir, "event", &counter_event[event]); gatorfs_create_ulong(sb, dir, "enabled", &counter_enabled[event]); gatorfs_create_ro_ulong(sb, dir, "key", &counter_key[event]); } return 0; }