summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Nabirushkin <inabirushkin@nvidia.com>2013-09-24 15:46:16 +0400
committerHarry Hong <hhong@nvidia.com>2013-12-10 16:21:29 -0800
commit6a1f8af7c5fe956aca1a03f5d35d9e8894bd93dc (patch)
tree6e346ff3386857ddb15766a4c41c0780c9a20777
parenta699e88b09cd9f8e367b0ad9c7f05b48ccbe484d (diff)
misc: tegra-profiler: send buffer fill count
Tegra Profiler misc driver: transmit the maximum buffer occupancy to the user space. Bug 1374266 Change-Id: Id078083a5493552c1f3bb697a1d3e4a5504e3f82 Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com> Reviewed-on: http://git-master/r/324051 (cherry picked from commit 9e94874e5edee9baa2e6be21712fa67a967eb6bc) Reviewed-on: http://git-master/r/340006 Reviewed-by: Harry Hong <hhong@nvidia.com> Tested-by: Harry Hong <hhong@nvidia.com>
-rw-r--r--drivers/misc/tegra-profiler/comm.c7
-rw-r--r--drivers/misc/tegra-profiler/comm.h1
-rw-r--r--drivers/misc/tegra-profiler/version.h2
-rw-r--r--include/linux/tegra_profiler.h9
4 files changed, 16 insertions, 3 deletions
diff --git a/drivers/misc/tegra-profiler/comm.c b/drivers/misc/tegra-profiler/comm.c
index e7a21ea10495..9273d8ad8991 100644
--- a/drivers/misc/tegra-profiler/comm.c
+++ b/drivers/misc/tegra-profiler/comm.c
@@ -46,6 +46,7 @@ static void rb_reset(struct quadd_ring_buffer *rb)
rb->pos_read = 0;
rb->pos_write = 0;
rb->fill_count = 0;
+ rb->max_fill_count = 0;
}
static int rb_init(struct quadd_ring_buffer *rb, size_t size)
@@ -225,6 +226,10 @@ write_sample(struct quadd_record_data *sample, void *extra_data,
return;
}
}
+
+ if (rb->fill_count > rb->max_fill_count)
+ rb->max_fill_count = rb->fill_count;
+
spin_unlock_irqrestore(&rb->lock, flags);
}
@@ -541,6 +546,8 @@ device_ioctl(struct file *file,
spin_lock_irqsave(&rb->lock, flags);
state.buffer_fill_size =
comm_ctx.rb_size - rb_get_free_space(rb);
+ state.reserved[QUADD_MOD_STATE_IDX_RB_MAX_FILL_COUNT] =
+ rb->max_fill_count;
spin_unlock_irqrestore(&rb->lock, flags);
if (copy_to_user((void __user *)ioctl_param, &state,
diff --git a/drivers/misc/tegra-profiler/comm.h b/drivers/misc/tegra-profiler/comm.h
index e3c7e28719ef..f519f17b317c 100644
--- a/drivers/misc/tegra-profiler/comm.h
+++ b/drivers/misc/tegra-profiler/comm.h
@@ -32,6 +32,7 @@ struct quadd_ring_buffer {
size_t pos_read;
size_t pos_write;
size_t fill_count;
+ size_t max_fill_count;
};
struct quadd_parameters;
diff --git a/drivers/misc/tegra-profiler/version.h b/drivers/misc/tegra-profiler/version.h
index 8d2eec0e2c2d..2d55c518b506 100644
--- a/drivers/misc/tegra-profiler/version.h
+++ b/drivers/misc/tegra-profiler/version.h
@@ -18,7 +18,7 @@
#ifndef __QUADD_VERSION_H
#define __QUADD_VERSION_H
-#define QUADD_MODULE_VERSION "1.31"
+#define QUADD_MODULE_VERSION "1.32"
#define QUADD_MODULE_BRANCH "Dev"
#endif /* __QUADD_VERSION_H */
diff --git a/include/linux/tegra_profiler.h b/include/linux/tegra_profiler.h
index 5840ba3a8824..2efa9c185e6c 100644
--- a/include/linux/tegra_profiler.h
+++ b/include/linux/tegra_profiler.h
@@ -20,9 +20,10 @@
#include <linux/ioctl.h>
#define QUADD_SAMPLES_VERSION 16
-#define QUADD_IO_VERSION 5
+#define QUADD_IO_VERSION 6
-#define QUADD_IO_VERSION_DYNAMIC_RB 5
+#define QUADD_IO_VERSION_DYNAMIC_RB 5
+#define QUADD_IO_VERSION_RB_MAX_FILL_COUNT 6
#define QUADD_MAX_COUNTERS 32
#define QUADD_MAX_PROCESS 64
@@ -283,6 +284,10 @@ struct quadd_comm_cap {
u32 reserved[16]; /* reserved fields for future extensions */
};
+enum {
+ QUADD_MOD_STATE_IDX_RB_MAX_FILL_COUNT = 0,
+};
+
struct quadd_module_state {
u64 nr_all_samples;
u64 nr_skipped_samples;