mmc: core: capture performance numbers only when asked
Currently performance numbers are captured for each SDCC
transfers unconditionally which may add the overhead and
could reduce the SDCC read/write throughput numbers.
This change adds additional control for enabling/disabling the
capturing of performance numbers at runtime. We already have sysfs
entry named "perf" for msm sdcc devices. Currently setting this
entry to 0 clears the performance statistics. But now we are
changing the definition of this entry as mentioned below:
Disable performance capturing and clear the performance statistics:
"echo 0 > /sys/devices/platform/msm_sdcc.<n>/perf"
Enable performance capturing:
"echo 1 > /sys/devices/platform/msm_sdcc.<n>/perf"
CRs-fixed: 345170
Change-Id: I3ab9288fd87cc8a8ada6c0c3d066cac4f68d79b7
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 3880f0f..54467dd 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -689,18 +689,23 @@
{
int64_t value;
struct mmc_host *host = dev_get_drvdata(dev);
+
sscanf(buf, "%lld", &value);
+ spin_lock(&host->lock);
if (!value) {
- spin_lock(&host->lock);
memset(&host->perf, 0, sizeof(host->perf));
- spin_unlock(&host->lock);
+ host->perf_enable = false;
+ } else {
+ host->perf_enable = true;
}
+ spin_unlock(&host->lock);
return count;
}
static DEVICE_ATTR(perf, S_IRUGO | S_IWUSR,
show_perf, set_perf);
+
#endif
static struct attribute *dev_attrs[] = {