gator: Version 5.19
[firefly-linux-kernel-4.4.55.git] / drivers / gator / gator_events_mmapped.c
index 3b248ec24e6e36b0c1013178d3158c5a423062a0..5bc01c42c3a2cf983e7937737e63104ec454a5f6 100644 (file)
@@ -8,21 +8,25 @@
  * published by the Free Software Foundation.
  *
  * Similar entries to those below must be present in the events.xml file.
- * To add them to the events.xml, create an events-mmap.xml with the 
+ * To add them to the events.xml, create an events-mmap.xml with the
  * following contents and rebuild gatord:
  *
- * <counter_set name="mmapped_cnt" count="3"/>
- * <category name="mmapped" counter_set="mmapped_cnt" per_cpu="no">
- *   <event event="0x0" title="Simulated1" name="Sine" display="maximum" average_selection="yes" description="Sort-of-sine"/>
- *   <event event="0x1" title="Simulated2" name="Triangle" display="maximum" average_selection="yes" description="Triangular wave"/>
- *   <event event="0x2" title="Simulated3" name="PWM" display="maximum" average_selection="yes" description="PWM Signal"/>
+ * <category name="mmapped">
+ *   <event counter="mmapped_cnt0" title="Simulated1" name="Sine" display="maximum" class="absolute" description="Sort-of-sine"/>
+ *   <event counter="mmapped_cnt1" title="Simulated2" name="Triangle" display="maximum" class="absolute" description="Triangular wave"/>
+ *   <event counter="mmapped_cnt2" title="Simulated3" name="PWM" display="maximum" class="absolute" description="PWM Signal"/>
  * </category>
  *
- * When adding custom events, be sure do the following
+ * When adding custom events, be sure to do the following:
  * - add any needed .c files to the gator driver Makefile
  * - call gator_events_install in the events init function
  * - add the init function to GATOR_EVENTS_LIST in gator_main.c
  * - add a new events-*.xml file to the gator daemon and rebuild
+ *
+ * Troubleshooting:
+ * - verify the new events are part of events.xml, which is created when building the daemon
+ * - verify the new events exist at /dev/gator/events/ once gatord is launched
+ * - verify the counter name in the XML matches the name at /dev/gator/events
  */
 
 #include <linux/init.h>
@@ -37,7 +41,6 @@ static int mmapped_global_enabled;
 
 static struct {
        unsigned long enabled;
-       unsigned long event;
        unsigned long key;
 } mmapped_counters[MMAPPED_COUNTERS_NUM];
 
@@ -47,7 +50,7 @@ static s64 prev_time;
 
 /* 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)
+                                            struct dentry *root)
 {
        int i;
 
@@ -61,8 +64,6 @@ static int gator_events_mmapped_create_files(struct super_block *sb,
                        return -1;
                gatorfs_create_ulong(sb, dir, "enabled",
                                     &mmapped_counters[i].enabled);
-               gatorfs_create_ulong(sb, dir, "event",
-                                    &mmapped_counters[i].event);
                gatorfs_create_ro_ulong(sb, dir, "key",
                                        &mmapped_counters[i].key);
        }
@@ -177,8 +178,7 @@ static int gator_events_mmapped_read(int **buffer)
                if (mmapped_counters[i].enabled) {
                        mmapped_buffer[len++] = mmapped_counters[i].key;
                        mmapped_buffer[len++] =
-                           mmapped_simulate(mmapped_counters[i].event,
-                                           delta_in_us);
+                           mmapped_simulate(i, delta_in_us);
                }
        }