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>
This commit is contained in:
parent
0f618d04ba
commit
9a09218381
3 changed files with 24 additions and 13 deletions
|
@ -179,17 +179,21 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq)
|
||||||
|
|
||||||
if (mrq->data) {
|
if (mrq->data) {
|
||||||
#ifdef CONFIG_MMC_PERF_PROFILING
|
#ifdef CONFIG_MMC_PERF_PROFILING
|
||||||
|
if (host->perf_enable) {
|
||||||
diff = ktime_sub(ktime_get(), host->perf.start);
|
diff = ktime_sub(ktime_get(), host->perf.start);
|
||||||
if (mrq->data->flags == MMC_DATA_READ) {
|
if (mrq->data->flags == MMC_DATA_READ) {
|
||||||
host->perf.rbytes_drv +=
|
host->perf.rbytes_drv +=
|
||||||
mrq->data->bytes_xfered;
|
mrq->data->bytes_xfered;
|
||||||
host->perf.rtime_drv =
|
host->perf.rtime_drv =
|
||||||
ktime_add(host->perf.rtime_drv, diff);
|
ktime_add(host->perf.rtime_drv,
|
||||||
|
diff);
|
||||||
} else {
|
} else {
|
||||||
host->perf.wbytes_drv +=
|
host->perf.wbytes_drv +=
|
||||||
mrq->data->bytes_xfered;
|
mrq->data->bytes_xfered;
|
||||||
host->perf.wtime_drv =
|
host->perf.wtime_drv =
|
||||||
ktime_add(host->perf.wtime_drv, diff);
|
ktime_add(host->perf.wtime_drv,
|
||||||
|
diff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
pr_debug("%s: %d bytes transferred: %d\n",
|
pr_debug("%s: %d bytes transferred: %d\n",
|
||||||
|
@ -313,6 +317,7 @@ static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
|
||||||
mrq->stop->mrq = mrq;
|
mrq->stop->mrq = mrq;
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_MMC_PERF_PROFILING
|
#ifdef CONFIG_MMC_PERF_PROFILING
|
||||||
|
if (host->perf_enable)
|
||||||
host->perf.start = ktime_get();
|
host->perf.start = ktime_get();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -651,18 +651,23 @@ set_perf(struct device *dev, struct device_attribute *attr,
|
||||||
{
|
{
|
||||||
int64_t value;
|
int64_t value;
|
||||||
struct mmc_host *host = dev_get_drvdata(dev);
|
struct mmc_host *host = dev_get_drvdata(dev);
|
||||||
|
|
||||||
sscanf(buf, "%lld", &value);
|
sscanf(buf, "%lld", &value);
|
||||||
if (!value) {
|
|
||||||
spin_lock(&host->lock);
|
spin_lock(&host->lock);
|
||||||
|
if (!value) {
|
||||||
memset(&host->perf, 0, sizeof(host->perf));
|
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;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DEVICE_ATTR(perf, S_IRUGO | S_IWUSR,
|
static DEVICE_ATTR(perf, S_IRUGO | S_IWUSR,
|
||||||
show_perf, set_perf);
|
show_perf, set_perf);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct attribute *dev_attrs[] = {
|
static struct attribute *dev_attrs[] = {
|
||||||
|
|
|
@ -442,6 +442,7 @@ struct mmc_host {
|
||||||
ktime_t wtime_drv; /* Wr time MMC Host */
|
ktime_t wtime_drv; /* Wr time MMC Host */
|
||||||
ktime_t start;
|
ktime_t start;
|
||||||
} perf;
|
} perf;
|
||||||
|
bool perf_enable;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned long private[0] ____cacheline_aligned;
|
unsigned long private[0] ____cacheline_aligned;
|
||||||
|
|
Loading…
Add table
Reference in a new issue