From: David Mosberger <davidm@napali.hpl.hp.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] VHPT performance
Date: Fri, 01 Mar 2002 02:32:07 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590701905205@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590701905139@msgid-missing>
>>>>> On Thu, 28 Feb 2002 09:06:54 +0100, Christian Hildner <christian.hildner@hob.de> said:
Christian> David Could you please send me your test program to
Christian> verify this. Since I haven't fixed the storage in my test
Christian> prog maybe there are additional page faults.
Well, the copyright is almost longer than the program itself, but here
you go. It was just a quick hack, so treat with care... If you do
make enhancements, I'd be interested, though.
--david
/*
Copyright (c) 1999-2002 Hewlett-Packard Co.
Written by David Mosberger-Tang <davidm@hpl.hp.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
The program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. */
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#define MAX_DTLB_SIZE 4096
#define PAGE_SIZE 65536
#define LINE_SIZE 64
#define LONGS_PER_LINE (LINE_SIZE/sizeof(long))
#define LOOKUPS_PER_TEST 30000000
static long page[2*MAX_DTLB_SIZE][PAGE_SIZE/sizeof(long)];
long
walk (long count)
{
long index = 0, i, sum = 0;
for (i = 0; i < LOOKUPS_PER_TEST; ++i)
{
sum += page[index][(index*LONGS_PER_LINE) % (PAGE_SIZE/sizeof(long))];
++index;
if (index >= count)
index = 0;
}
return sum;
}
void
run (const char *label, long (*func)(long), long count)
{
struct timeval tv_start, tv_stop;
double delta;
long result;
int n;
for (n = 0; n < 1; ++n)
{
gettimeofday(&tv_start, 0);
result = (*func)(count);
gettimeofday(&tv_stop, 0);
delta = ((tv_stop.tv_sec + tv_stop.tv_usec / 1000000.0)
- (tv_start.tv_sec + tv_start.tv_usec / 1000000.0));
if (delta > 0.0)
printf("%s: %10.5g seconds: %10.5g ns/access (checksum=%lu)\n",
label, delta, 1e9 * delta / LOOKUPS_PER_TEST, result);
}
}
int
main (int argc, char ** argv)
{
char buf[256];
int i;
for (i = 0; i < MAX_DTLB_SIZE; i += 1 + i/100)
{
sprintf (buf, "%3u", i);
run(buf, walk, i);
}
return 0;
}
next prev parent reply other threads:[~2002-03-01 2:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-20 12:21 [Linux-ia64] VHPT performance Christian Hildner
2002-02-20 17:02 ` Michael Madore
2002-02-20 17:34 ` David Mosberger
2002-02-22 11:35 ` Christian Hildner
2002-02-22 16:58 ` David Mosberger
2002-02-28 8:06 ` Christian Hildner
2002-03-01 2:32 ` David Mosberger [this message]
2002-03-08 7:50 ` Christian Hildner
2002-03-08 8:12 ` David Mosberger
2002-03-08 10:26 ` Christian Hildner
2002-03-08 17:31 ` David Mosberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=marc-linux-ia64-105590701905205@msgid-missing \
--to=davidm@napali.hpl.hp.com \
--cc=linux-ia64@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.