From: "Richard B. Johnson" <root@chaos.analogic.com>
To: Bernd Petrovitsch <bernd@gams.at>
Cc: Srihari Vijayaraghavan <harisri@bigpond.com>,
Tim Schmielau <tim@physik3.uni-rostock.de>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: Bottleneck on /dev/null
Date: Thu, 20 Mar 2003 12:01:06 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.53.0303201150140.4241@chaos> (raw)
In-Reply-To: <28588.1048178012@frodo.gams.co.at>
On Thu, 20 Mar 2003, Bernd Petrovitsch wrote:
> Tim Schmielau <tim@physik3.uni-rostock.de> wrote:
> >On Thu, 20 Mar 2003, Richard B. Johnson wrote:
> >
> >> unsigned long amount = 0L;
> >
> >try 'volatile' to get the deviation down...
>
> .. and try "long long" to avoid an overrun.
>
> Bernd
> --
Yes. That's better. It may have been a diagnostic error
in the code of the first person reporting this --also.
The data-rate is so high that I might have wrapped several
times! I didn't think it would be that high, only 2 to 3
gigibyte/second, not over 4 Gb/s (with 130MHz RAM no less)
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include <time.h>
#define BUF_LEN 0x10000
volatile unsigned long long amount = 0L;
void timer(int unused) {
fprintf(stdout, "Kilobytes / sec = %llu\n", amount >> 10);
fflush(stdout);
amount = 0LL;
alarm(1);
}
int main() {
int fd, len;
char *buf;
if((fd = open("/dev/null", O_RDWR)) < 0)
exit(EXIT_FAILURE);
if((buf = malloc(BUF_LEN)) == NULL)
exit(EXIT_FAILURE);
(void)signal(SIGALRM, timer);
alarm(1);
while((len = write(fd, buf, BUF_LEN)) > 0)
amount += (unsigned long long) len;
free(buf);
return 0;
}
With network:
Kilobytes / sec = 46170080
Kilobytes / sec = 46171576
Kilobytes / sec = 46172944
Kilobytes / sec = 46172192
Kilobytes / sec = 46171840
Kilobytes / sec = 46171576
Without network:
Kilobytes / sec = 46128168
Kilobytes / sec = 46128200
Kilobytes / sec = 46128152
Kilobytes / sec = 46128142
Kilobytes / sec = 46128208
Kilobytes / sec = 46128198
Kilobytes / sec = 46128202
Its interesting that the data-rate is higher with the network
plugged in and getting all those M$ broadcast messages. But, as
expected, its more stable without.
Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.
next prev parent reply other threads:[~2003-03-20 16:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-20 14:57 Srihari Vijayaraghavan
2003-03-20 15:54 ` Richard B. Johnson
2003-03-20 16:21 ` Tim Schmielau
2003-03-20 16:33 ` Bernd Petrovitsch
2003-03-20 17:01 ` Richard B. Johnson [this message]
2003-03-20 17:07 ` Matti Aarnio
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=Pine.LNX.4.53.0303201150140.4241@chaos \
--to=root@chaos.analogic.com \
--cc=bernd@gams.at \
--cc=harisri@bigpond.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tim@physik3.uni-rostock.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®