summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Nabirushkin <inabirushkin@nvidia.com>2013-09-24 15:46:16 +0400
committerRiham Haidar <rhaidar@nvidia.com>2013-11-07 12:11:52 -0800
commite35f1b96133d71434ef7d6910b730f85fe05d2d5 (patch)
tree7360bc2de6c3fac2715a1ec88817641323aebf06
parenta631d021452d987618875c262e7b968f3304eb84 (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/309633 (cherry picked from commit 757f16d5b83328d984feb3f37ebe6790fb42d15d) Reviewed-on: http://git-master/r/325975 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Tested-by: Maxim Morin <mmorin@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@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;