diff options
author | Patrick Daly <pdaly@codeaurora.org> | 2015-11-20 20:33:04 -0800 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:14:36 -0700 |
commit | 75a6af118d88791a78eb8a98db4e31f83ee7d91d (patch) | |
tree | fec54a2360e8e2ba30f982e68fa695c95a0f7758 /drivers/iommu | |
parent | b07bee32274cbe022932aa9a5bbf8d94c855ad96 (diff) |
iommu/iommu-debug: Add 3 more signifigant digits
Print time with ns precision.
Ex:
size iommu_map iommu_unmap
4K 43.021 us 99.479 us
Change-Id: Ib7f3db2be533c77adf0a20de557615a0e2433dd9
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/iommu-debug.c | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/drivers/iommu/iommu-debug.c b/drivers/iommu/iommu-debug.c index 1c22d70336cf..909e55a70915 100644 --- a/drivers/iommu/iommu-debug.c +++ b/drivers/iommu/iommu-debug.c @@ -497,11 +497,13 @@ static void iommu_debug_device_profiling(struct seq_file *s, struct device *dev, } seq_printf(s, "(average over %d iterations)\n", iters_per_op); - seq_printf(s, "%8s %15s %12s\n", "size", "iommu_map", "iommu_unmap"); + seq_printf(s, "%8s %19s %16s\n", "size", "iommu_map", "iommu_unmap"); for (sz = sizes; *sz; ++sz) { unsigned long size = *sz; size_t unmapped; + u64 map_elapsed_ns = 0, unmap_elapsed_ns = 0; u64 map_elapsed_us = 0, unmap_elapsed_us = 0; + u32 map_elapsed_rem = 0, unmap_elapsed_rem = 0; struct timespec tbefore, tafter, diff; int i; @@ -514,7 +516,7 @@ static void iommu_debug_device_profiling(struct seq_file *s, struct device *dev, } getnstimeofday(&tafter); diff = timespec_sub(tafter, tbefore); - map_elapsed_us += div_s64(timespec_to_ns(&diff), 1000); + map_elapsed_ns += timespec_to_ns(&diff); getnstimeofday(&tbefore); unmapped = iommu_unmap(domain, iova, size); @@ -526,23 +528,31 @@ static void iommu_debug_device_profiling(struct seq_file *s, struct device *dev, } getnstimeofday(&tafter); diff = timespec_sub(tafter, tbefore); - unmap_elapsed_us += div_s64(timespec_to_ns(&diff), - 1000); + unmap_elapsed_ns += timespec_to_ns(&diff); } - map_elapsed_us /= iters_per_op; - unmap_elapsed_us /= iters_per_op; + map_elapsed_ns /= iters_per_op; + unmap_elapsed_ns /= iters_per_op; - seq_printf(s, "%8s %12lld us %9lld us\n", _size_to_string(size), - map_elapsed_us, unmap_elapsed_us); + map_elapsed_us = div_u64_rem(map_elapsed_ns, 1000, + &map_elapsed_rem); + unmap_elapsed_us = div_u64_rem(unmap_elapsed_ns, 1000, + &unmap_elapsed_rem); + + seq_printf(s, "%8s %12lld.%03d us %9lld.%03d us\n", + _size_to_string(size), + map_elapsed_us, map_elapsed_rem, + unmap_elapsed_us, unmap_elapsed_rem); } seq_putc(s, '\n'); - seq_printf(s, "%8s %15s %12s\n", "size", "iommu_map_sg", "iommu_unmap"); + seq_printf(s, "%8s %19s %16s\n", "size", "iommu_map_sg", "iommu_unmap"); for (sz = sizes; *sz; ++sz) { unsigned long size = *sz; size_t unmapped; + u64 map_elapsed_ns = 0, unmap_elapsed_ns = 0; u64 map_elapsed_us = 0, unmap_elapsed_us = 0; + u32 map_elapsed_rem = 0, unmap_elapsed_rem = 0; struct timespec tbefore, tafter, diff; struct sg_table table; unsigned long chunk_size = SZ_4K; @@ -564,7 +574,7 @@ static void iommu_debug_device_profiling(struct seq_file *s, struct device *dev, } getnstimeofday(&tafter); diff = timespec_sub(tafter, tbefore); - map_elapsed_us += div_s64(timespec_to_ns(&diff), 1000); + map_elapsed_ns += timespec_to_ns(&diff); getnstimeofday(&tbefore); unmapped = iommu_unmap(domain, iova, size); @@ -576,15 +586,21 @@ static void iommu_debug_device_profiling(struct seq_file *s, struct device *dev, } getnstimeofday(&tafter); diff = timespec_sub(tafter, tbefore); - unmap_elapsed_us += div_s64(timespec_to_ns(&diff), - 1000); + unmap_elapsed_ns += timespec_to_ns(&diff); } - map_elapsed_us /= iters_per_op; - unmap_elapsed_us /= iters_per_op; + map_elapsed_ns /= iters_per_op; + unmap_elapsed_ns /= iters_per_op; + + map_elapsed_us = div_u64_rem(map_elapsed_ns, 1000, + &map_elapsed_rem); + unmap_elapsed_us = div_u64_rem(unmap_elapsed_ns, 1000, + &unmap_elapsed_rem); - seq_printf(s, "%8s %12lld us %9lld us\n", _size_to_string(size), - map_elapsed_us, unmap_elapsed_us); + seq_printf(s, "%8s %12lld.%03d us %9lld.%03d us\n", + _size_to_string(size), + map_elapsed_us, map_elapsed_rem, + unmap_elapsed_us, unmap_elapsed_rem); next: iommu_debug_destroy_phoney_sg_table(dev, &table, chunk_size); |