summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2004-07-12 22:51:20 -0400
committerAli Saidi <saidi@eecs.umich.edu>2004-07-12 22:51:20 -0400
commitc2e5caf3606b85b6f45cde53b8021692ef01710e (patch)
tree9b54ed6e37afa3912699a4624935956c7d885f75
parentef16b4648406f87940abeb5616fb82cd2cd7e7a6 (diff)
downloadgem5-c2e5caf3606b85b6f45cde53b8021692ef01710e.tar.xz
modified devtime to print out raw data
--HG-- extra : convert_revision : 5ad673d6f684acaffeb61db794f7e2ac099ba99d
-rw-r--r--util/ccdrv/devtime.c59
1 files changed, 38 insertions, 21 deletions
diff --git a/util/ccdrv/devtime.c b/util/ccdrv/devtime.c
index 0e5d17f60..c3897e597 100644
--- a/util/ccdrv/devtime.c
+++ b/util/ccdrv/devtime.c
@@ -46,7 +46,6 @@
#define DRIVER_DESC "Interface to time uncacachable read and writes to device registers"
#define DRIVER_VER "0.1"
-static unsigned long devCnt, devSum, devSsq;
static char *dataAddr = NULL;
static int count = 0;
@@ -55,35 +54,43 @@ static inline uint32_t cycleCounter(uint32_t dep);
static int __init devtime_start(void)
{
uint64_t addr;
- uint32_t t1, t2;
+ uint32_t t1, t2;
uint32_t trash;
int x;
-
+ uint32_t *times;
+ uint32_t num = 0;
struct net_device *dev;
printk("Devtime Driver Version %s Loaded...\n", DRIVER_VER);
- if (dataAddr != 0 && count != 0) {
+ if ((dataAddr != 0) && (count != 0))
+ {
addr = simple_strtoull(dataAddr, NULL, 0);
- devSum = 0;
- devCnt = count;
-
addr = ioremap(addr, PAGE_SIZE);
/**
* Make sure that the remapping actually worked. On alpha we have
* linear addressing, so its not a problem. But it can fail in x86
* if physical memory is mapped to this address.
*/
- if (addr) {
+ times = kmalloc(sizeof(uint32_t) * count, GFP_USER);
+ if (!times)
+ {
+ printk("Could not allocate memory... Try again later.\n");
+ return -1;
+ }
+
+ if (addr)
+ {
printk("Preparing to read %#llx %d times.\n", addr, count);
t1 = cycleCounter(trash);
- for (x = 0; x < count; x++) {
+ for (x=0; x < count; x++)
+ {
trash = readl(addr);
t2 = cycleCounter(trash);
- devSum += t2 - t1;
+ times[num++] = t2 - t1;
t1 = t2;
}
@@ -92,26 +99,37 @@ static int __init devtime_start(void)
*/
iounmap(addr);
- printk("Read Address %#llx %ld times. Average latency %ld.\n",
- addr, devCnt, devSum/devCnt);
+ printk("Measurements:\n");
+ for (x = 0; x < count; x++)
+ {
+ printk("%d ", times[x]);
+ if (((x+1) % 10) == 0)
+ printk("\n");
+ }
+ printk("\nDone.\n");
+
+
}
else
printk("Unable to remap address. Please try again later.\n");
} else {
dev = dev_get_by_name("eth0");
- if (dev) {
- printk("Eth0: MemStart: %#lx MemEnd: %#lx I/O Addr: %#lx\n",
- dev->mem_start, dev->mem_end, dev->base_addr);
+ if (dev)
+ {
+ printk("Eth0: MemStart: %#lx MemEnd: %#lx I/O Addr: %#lx\n", dev->mem_start,
+ dev->mem_end, dev->base_addr);
dev_put(dev);
}
dev = 0;
dev = dev_get_by_name("eth1");
- if (dev) {
- printk("Eth1: MemStart: %#lx MemEnd: %#lx I/O Addr: %#lx\n",
- dev->mem_start, dev->mem_end, dev->base_addr);
+ if (dev)
+ {
+ printk("Eth1: MemStart: %#lx MemEnd: %#lx I/O Addr: %#lx\n", dev->mem_start,
+ dev->mem_end, dev->base_addr);
dev_put(dev);
}
+
printk("Required information not supplied.\n");
}
@@ -141,8 +159,7 @@ inline uint32_t cycleCounter(uint32_t dep)
#error Architecture NOT SUPPORTE
#endif
-static void __exit devtime_end(void)
-{
+static void __exit devtime_end(void) {
printk("Devtime Driver Version %s Unloaded...\n", DRIVER_VER);
}
@@ -150,7 +167,7 @@ static void __exit devtime_end(void)
module_init(devtime_start);
module_exit(devtime_end);
-MODULE_LICENSE("BSD");
+MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
module_param(dataAddr, charp, 0);