Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 45812 - Fixed ttcp for 64-bit, tested and works on AMD64
Summary: Fixed ttcp for 64-bit, tested and works on AMD64
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: High enhancement
Assignee: AMD64 Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-26 08:41 UTC by John Stewart
Modified: 2004-05-26 12:22 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
patch to ttcp that adds patch application to src_unpack (ttcp-1.12.ebuild.patch,338 bytes, patch)
2004-03-26 08:46 UTC, John Stewart
Details | Diff
Patch that makes ttcp 64-bit clean(in theory). (ttcp-1.12-amd64.patch,5.19 KB, patch)
2004-03-26 08:47 UTC, John Stewart
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Stewart 2004-03-26 08:41:51 UTC
It will probably work on other 64-bit architectures as well.
Patches for ttcp and the ebuild are attached.


Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 John Stewart 2004-03-26 08:46:11 UTC
Created attachment 28068 [details, diff]
patch to ttcp that adds patch application to src_unpack
Comment 2 John Stewart 2004-03-26 08:47:02 UTC
Created attachment 28069 [details, diff]
Patch that makes ttcp 64-bit clean(in theory).
Comment 3 Travis Tilley (RETIRED) gentoo-dev 2004-04-07 16:42:27 UTC
have you tried this with nttcp?

Description: New version of ttcp -- Tool to test TCP and UDP throughput
Comment 4 John Stewart 2004-04-07 19:41:03 UTC
No sorry I haven't messed with nttcp.  Though I did also fix up the Windows version of ttcp that I got from the Cygwin project.

Are there any advantages to nttcp that would make it worth taking a look at?  The main reason I grabbed/fixed ttcp was that I recently put together a small gigabit LAN and needed a non file copy based method for testing throughput as I tweaked things.

On another note I've tested the patched version of sgi-ttcp.c on an x86 gentoo box and it works fine there as well.  I've also modified my copy to print out the actual size of the SO_SNDBUF and SO_RCVBUF parameters.  Not sure if anyone would be interested in that?
Comment 5 Travis Tilley (RETIRED) gentoo-dev 2004-04-07 20:24:54 UTC
well, I've havent really made use of either one and they both appear to be dead development-wise... but there's only so much development one can do on an app like ttcp that doesn't involve porting anyway. :)

list of improvements (from the nttcp page):

    * Ported to varity of systems (HPUX, AIX, IRIX, OFS/1, SunOS.4, SunSolaris 5.*, [Free,Net]BSD).
    * Can be started via inetd; you need not be logged in on the remote side to make transfers to this machin.
    * Output can be customized on commandline
    * Different commandline options for the remote side in one call
    * Measures on boths sides of the connection and reports both measurements on the calling side.
    * Can checksum the traffic, to detect data failures in UDP transmissions
    * sending of multicast pakets.

anyways, I was just curious about nttcp.


also, both nttcp and ttcp compile without problems here... could you provide me with additional information about what you mean by 64bit clean?



ayanami ttcp # ttcp -t -s localhost
ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp  -> localhost
ttcp-t: socket
ttcp-t: connect
ttcp-t: 16777216 bytes in 0.05 real seconds = 327647.24 KB/sec +++
ttcp-t: 2048 I/O calls, msec/call = 0.03, calls/sec = 40955.90
ttcp-t: 0.0user 0.0sys 0:00real 0% 0i+0d 0maxrss 0+2pf 339+1csw

ayanami ttcp # nttcp -s localhost
l  8388608    0.13    0.05    519.6356   1428.0912    2048  15858.02   43581.9
1  8388608    0.13    0.08    519.0288    818.5305    2049  15847.24   24991.8


I will mark both applications as testing on amd64 as they are, and I'll leave this bug open until you can explain to me what I'm missing here.
Comment 6 John Stewart 2004-04-07 22:42:53 UTC
The "big" problem was in the buffer alignment code.  It was casting a pointer to an int which on a 64 bit machine would truncate it to 32 bits.

The other main problem was many printf format statements that specified an int when the arguement was a long int.  I.e. I changed a bunch of %d format specifiers to to %ld.

I also cleaned up all but one warning when it is compiled with the -Wall flag.


Specifically with the original version gcc -Wall sgi-ttcp.c prints the following warnings:
sgi-ttcp.c:151: warning: return type defaults to `int'
sgi-ttcp.c: In function `main':
sgi-ttcp.c:159: warning: implicit declaration of function `getopt'
sgi-ttcp.c:183: warning: implicit declaration of function `atoi'
sgi-ttcp.c:229: warning: implicit declaration of function `bzero'
sgi-ttcp.c:244: warning: implicit declaration of function `bcopy'
sgi-ttcp.c:263: warning: implicit declaration of function `malloc'
sgi-ttcp.c:263: warning: cast to pointer from integer of different size
sgi-ttcp.c:266: warning: cast from pointer to integer of different size
sgi-ttcp.c:288: warning: passing arg 2 of `bind' from incompatible pointer type
sgi-ttcp.c:329: warning: passing arg 2 of `connect' from incompatible pointer type
sgi-ttcp.c:351: warning: passing arg 2 of `accept' from incompatible pointer type
sgi-ttcp.c:356: warning: passing arg 2 of `getpeername' from incompatible pointer type
sgi-ttcp.c:396: warning: implicit declaration of function `read'
sgi-ttcp.c:401: warning: implicit declaration of function `write'
sgi-ttcp.c:430: warning: int format, different type arg (arg 4)
sgi-ttcp.c:436: warning: unsigned int format, pointer arg (arg 4)
sgi-ttcp.c:438: warning: implicit declaration of function `exit'
sgi-ttcp.c: At top level:
sgi-ttcp.c:463: warning: return type defaults to `int'
sgi-ttcp.c: In function `pattern':
sgi-ttcp.c:472: warning: control reaches end of non-void function
sgi-ttcp.c: In function `read_timer':
sgi-ttcp.c:567: warning: implicit declaration of function `strncpy'
sgi-ttcp.c: In function `prusage':
sgi-ttcp.c:617: warning: int format, different type arg (arg 3)
sgi-ttcp.c:617: warning: int format, different type arg (arg 4)
sgi-ttcp.c:623: warning: int format, different type arg (arg 3)
sgi-ttcp.c:623: warning: int format, different type arg (arg 4)
sgi-ttcp.c:645: warning: int format, different type arg (arg 3)
sgi-ttcp.c:651: warning: int format, different type arg (arg 3)
sgi-ttcp.c:658: warning: int format, different type arg (arg 3)
sgi-ttcp.c:663: warning: int format, different type arg (arg 3)
sgi-ttcp.c:668: warning: int format, different type arg (arg 3)
sgi-ttcp.c:673: warning: int format, different type arg (arg 3)
sgi-ttcp.c:678: warning: int format, different type arg (arg 3)
sgi-ttcp.c:683: warning: int format, different type arg (arg 3)
sgi-ttcp.c:688: warning: int format, different type arg (arg 3)
sgi-ttcp.c:688: warning: int format, different type arg (arg 4)
sgi-ttcp.c: At top level:
sgi-ttcp.c:747: warning: return type defaults to `int'
sgi-ttcp.c: In function `Nread':
sgi-ttcp.c:755: warning: passing arg 5 of `recvfrom' from incompatible pointer type
sgi-ttcp.c: At top level:
sgi-ttcp.c:778: warning: return type defaults to `int'
sgi-ttcp.c: In function `Nwrite':
sgi-ttcp.c:785: warning: passing arg 5 of `sendto' from incompatible pointer type
sgi-ttcp.c: In function `delay':
sgi-ttcp.c:806: warning: passing arg 2 of `select' from incompatible pointer type
sgi-ttcp.c:806: warning: passing arg 3 of `select' from incompatible pointer type
sgi-ttcp.c:806: warning: passing arg 4 of `select' from incompatible pointer type
sgi-ttcp.c: At top level:
sgi-ttcp.c:39: warning: `RCSid' defined but not used


Whereas on the patched version it only prints:
sgi-ttcp.c:39: warning: `RCSid' defined but not used


I'll take a look at nttcp.  Having it running as a service would sure make it more convenient to use.
Comment 7 Travis Tilley (RETIRED) gentoo-dev 2004-05-26 12:22:00 UTC
sorry it took so long, i got distracted