diff options
| author | Noor Ahsan <noor_ahsan@mentor.com> | 2011-08-29 12:15:22 +0500 |
|---|---|---|
| committer | Noor Ahsan <noor_ahsan@mentor.com> | 2011-08-29 12:15:22 +0500 |
| commit | 79d102b2c42443d6a089ba85639de8e1e3721e25 (patch) | |
| tree | 95c57aa0a3da3439942595d78433d884035ca46d /meta-oe | |
| parent | 0efa8c83632b62007db2a307b9264eb6bd0ac82f (diff) | |
| download | meta-openembedded-79d102b2c42443d6a089ba85639de8e1e3721e25.tar.gz | |
iperf: Add version 2.0.4 (initial recipe)
* Imported from oe.dev commit id 0ff10ecb88de73074ae4857046643cef15dc4e97 and c10c33f86903c93611023197a7f812459c2dfe2d.
* Combined .inc and bb file from oe.dev and made a single bb file.
* Removed EXTRA_OECONF_append_epia = " --disable-threads" while importing as this should go in epia layer.
Signed-off-by: Noor Ahsan <noor_ahsan@mentor.com>
Diffstat (limited to 'meta-oe')
10 files changed, 654 insertions, 0 deletions
diff --git a/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/000-Iperf_Fix-CPU-Usage.diff b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/000-Iperf_Fix-CPU-Usage.diff new file mode 100644 index 0000000000..7e8995383b --- /dev/null +++ b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/000-Iperf_Fix-CPU-Usage.diff | |||
| @@ -0,0 +1,164 @@ | |||
| 1 | [Thread]: Replace thread_rest() with condition variables | ||
| 2 | |||
| 3 | This applies the patch by Ingo Molnar from | ||
| 4 | |||
| 5 | http://marc.info/?l=linux-kernel&m=119088670113210&w=2 | ||
| 6 | |||
| 7 | by reverting previous changes that coincided with changes made by this | ||
| 8 | patch. Other than that, the patch is the original from the above URL. | ||
| 9 | |||
| 10 | Gerrit | ||
| 11 | --- | ||
| 12 | compat/Thread.c | 6 ------ | ||
| 13 | src/Reporter.c | 37 +++++++++---------------------------- | ||
| 14 | src/main.cpp | 2 ++ | ||
| 15 | 3 files changed, 11 insertions(+), 34 deletions(-) | ||
| 16 | |||
| 17 | rover: changed two remaining thread_rest. | ||
| 18 | |||
| 19 | --- a/compat/Thread.c | ||
| 20 | +++ b/compat/Thread.c | ||
| 21 | @@ -405,12 +405,6 @@ int thread_numuserthreads( void ) { | ||
| 22 | void thread_rest ( void ) { | ||
| 23 | #if defined( HAVE_THREAD ) | ||
| 24 | #if defined( HAVE_POSIX_THREAD ) | ||
| 25 | -#if defined( _POSIX_PRIORITY_SCHEDULING ) | ||
| 26 | - sched_yield(); | ||
| 27 | -#else | ||
| 28 | - usleep( 0 ); | ||
| 29 | -#endif | ||
| 30 | - | ||
| 31 | #else // Win32 | ||
| 32 | SwitchToThread( ); | ||
| 33 | #endif | ||
| 34 | --- a/src/Reporter.c | ||
| 35 | +++ b/src/Reporter.c | ||
| 36 | @@ -110,9 +110,8 @@ | ||
| 37 | |||
| 38 | char buffer[64]; // Buffer for printing | ||
| 39 | ReportHeader *ReportRoot = NULL; | ||
| 40 | -int threadWait = 0; | ||
| 41 | -int threadSleeping = 0; | ||
| 42 | extern Condition ReportCond; | ||
| 43 | +extern Condition ReportDoneCond; | ||
| 44 | int reporter_process_report ( ReportHeader *report ); | ||
| 45 | void process_report ( ReportHeader *report ); | ||
| 46 | int reporter_handle_packet( ReportHeader *report ); | ||
| 47 | @@ -340,7 +339,7 @@ | ||
| 48 | // item | ||
| 49 | while ( index == 0 ) { | ||
| 50 | Condition_Signal( &ReportCond ); | ||
| 51 | - thread_rest(); | ||
| 52 | + Condition_Wait( &ReportDoneCond ); | ||
| 53 | index = agent->reporterindex; | ||
| 54 | } | ||
| 55 | agent->agentindex = 0; | ||
| 56 | @@ -348,11 +347,9 @@ | ||
| 57 | // Need to make sure that reporter is not about to be "lapped" | ||
| 58 | while ( index - 1 == agent->agentindex ) { | ||
| 59 | Condition_Signal( &ReportCond ); | ||
| 60 | - thread_rest(); | ||
| 61 | + Condition_Wait( &ReportDoneCond ); | ||
| 62 | index = agent->reporterindex; | ||
| 63 | } | ||
| 64 | - if (threadSleeping) | ||
| 65 | - Condition_Signal( &ReportCond ); | ||
| 66 | |||
| 67 | // Put the information there | ||
| 68 | memcpy( agent->data + agent->agentindex, packet, sizeof(ReportStruct) ); | ||
| 69 | @@ -382,9 +379,6 @@ | ||
| 70 | packet->packetLen = 0; | ||
| 71 | ReportPacket( agent, packet ); | ||
| 72 | packet->packetID = agent->report.cntDatagrams; | ||
| 73 | - if (threadSleeping) | ||
| 74 | - Condition_Signal( &ReportCond ); | ||
| 75 | - | ||
| 76 | } | ||
| 77 | } | ||
| 78 | |||
| 79 | @@ -396,11 +390,8 @@ | ||
| 80 | void EndReport( ReportHeader *agent ) { | ||
| 81 | if ( agent != NULL ) { | ||
| 82 | int index = agent->reporterindex; | ||
| 83 | - if (threadSleeping) | ||
| 84 | - Condition_Signal( &ReportCond ); | ||
| 85 | - | ||
| 86 | while ( index != -1 ) { | ||
| 87 | - thread_rest(); | ||
| 88 | + Condition_Wait( &ReportDoneCond ); | ||
| 89 | index = agent->reporterindex; | ||
| 90 | } | ||
| 91 | agent->agentindex = -1; | ||
| 92 | @@ -421,7 +412,7 @@ | ||
| 93 | Transfer_Info *GetReport( ReportHeader *agent ) { | ||
| 94 | int index = agent->reporterindex; | ||
| 95 | while ( index != -1 ) { | ||
| 96 | - thread_rest(); | ||
| 97 | + Condition_Wait( &ReportDoneCond ); | ||
| 98 | index = agent->reporterindex; | ||
| 99 | } | ||
| 100 | return &agent->report.info; | ||
| 101 | @@ -467,10 +458,6 @@ | ||
| 102 | * Update the ReportRoot to include this report. | ||
| 103 | */ | ||
| 104 | Condition_Lock( ReportCond ); | ||
| 105 | - if ( isUDP(agent) ) | ||
| 106 | - threadWait = 0; | ||
| 107 | - else | ||
| 108 | - threadWait = 1; | ||
| 109 | reporthdr->next = ReportRoot; | ||
| 110 | ReportRoot = reporthdr; | ||
| 111 | Condition_Signal( &ReportCond ); | ||
| 112 | @@ -567,6 +554,7 @@ | ||
| 113 | } | ||
| 114 | Condition_Unlock ( ReportCond ); | ||
| 115 | |||
| 116 | +again: | ||
| 117 | if ( ReportRoot != NULL ) { | ||
| 118 | ReportHeader *temp = ReportRoot; | ||
| 119 | //Condition_Unlock ( ReportCond ); | ||
| 120 | @@ -589,19 +577,12 @@ | ||
| 121 | // finished with report so free it | ||
| 122 | free( temp ); | ||
| 123 | Condition_Unlock ( ReportCond ); | ||
| 124 | + Condition_Signal( &ReportDoneCond ); | ||
| 125 | + if (ReportRoot) | ||
| 126 | + goto again; | ||
| 127 | } | ||
| 128 | - // yield control of CPU is another thread is waiting | ||
| 129 | - // sleep on a condition variable, as it is much cheaper | ||
| 130 | - // on most platforms than issuing schedyield or usleep | ||
| 131 | - // syscalls | ||
| 132 | - Condition_Lock ( ReportCond ); | ||
| 133 | - if ( threadWait && ReportRoot != NULL) { | ||
| 134 | - threadSleeping = 1; | ||
| 135 | - Condition_TimedWait (& ReportCond, 1 ); | ||
| 136 | - threadSleeping = 0; | ||
| 137 | - } | ||
| 138 | - Condition_Unlock ( ReportCond ); | ||
| 139 | - | ||
| 140 | + Condition_Signal( &ReportDoneCond ); | ||
| 141 | + usleep(10000); | ||
| 142 | } else { | ||
| 143 | //Condition_Unlock ( ReportCond ); | ||
| 144 | } | ||
| 145 | --- a/src/main.cpp | ||
| 146 | +++ b/src/main.cpp | ||
| 147 | @@ -96,6 +96,7 @@ extern "C" { | ||
| 148 | // records being accessed in a report and also to | ||
| 149 | // serialize modification of the report list | ||
| 150 | Condition ReportCond; | ||
| 151 | + Condition ReportDoneCond; | ||
| 152 | } | ||
| 153 | |||
| 154 | // global variables only accessed within this file | ||
| 155 | @@ -142,6 +143,7 @@ int main( int argc, char **argv ) { | ||
| 156 | |||
| 157 | // Initialize global mutexes and conditions | ||
| 158 | Condition_Initialize ( &ReportCond ); | ||
| 159 | + Condition_Initialize ( &ReportDoneCond ); | ||
| 160 | Mutex_Initialize( &groupCond ); | ||
| 161 | Mutex_Initialize( &clients_mutex ); | ||
| 162 | |||
| 163 | |||
| 164 | |||
diff --git a/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/001-cast-to-max_size_t-instead-of-int.patch b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/001-cast-to-max_size_t-instead-of-int.patch new file mode 100644 index 0000000000..b6728d43d7 --- /dev/null +++ b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/001-cast-to-max_size_t-instead-of-int.patch | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | Import Debian patches and fix a lot of real bugs. | ||
| 2 | |||
| 3 | Upstream-Status: Inappropriate [not author. Above message was get from oe.dev c10c33f86903c93611023197a7f812459c2dfe2d] | ||
| 4 | --- iperf-2.0.4.orig/src/Settings.cpp.orig 2008-04-08 04:37:54.000000000 +0200 | ||
| 5 | +++ iperf-2.0.4/src/Settings.cpp 2008-05-07 17:41:03.923942801 +0200 | ||
| 6 | @@ -458,7 +458,7 @@ | ||
| 7 | case 't': // seconds to write for | ||
| 8 | // time mode (instead of amount mode) | ||
| 9 | setModeTime( mExtSettings ); | ||
| 10 | - mExtSettings->mAmount = (int) (atof( optarg ) * 100.0); | ||
| 11 | + mExtSettings->mAmount = (max_size_t) (atof( optarg ) * 100.0); | ||
| 12 | break; | ||
| 13 | |||
| 14 | case 'u': // UDP instead of TCP | ||
diff --git a/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/003-fix-hyphen-used-as-minus-sign.patch b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/003-fix-hyphen-used-as-minus-sign.patch new file mode 100644 index 0000000000..929b5ac8d5 --- /dev/null +++ b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/003-fix-hyphen-used-as-minus-sign.patch | |||
| @@ -0,0 +1,178 @@ | |||
| 1 | Import Debian patches and fix a lot of real bugs. | ||
| 2 | |||
| 3 | Upstream-Status: Inappropriate [not author. Above message was get from oe.dev c10c33f86903c93611023197a7f812459c2dfe2d] | ||
| 4 | |||
| 5 | --- iperf-2.0.4.orig/man/iperf.1 2008-08-21 00:21:49.290527643 +0200 | ||
| 6 | +++ iperf-2.0.4/man/iperf.1 2008-08-21 00:35:17.850640445 +0200 | ||
| 7 | @@ -2,21 +2,21 @@ | ||
| 8 | .SH NAME | ||
| 9 | iperf \- perform network throughput tests | ||
| 10 | .SH SYNOPSIS | ||
| 11 | -.B iperf -s [ | ||
| 12 | +.B iperf \-s [ | ||
| 13 | .I options | ||
| 14 | .B ] | ||
| 15 | |||
| 16 | -.B iperf -c | ||
| 17 | +.B iperf \-c | ||
| 18 | .I server | ||
| 19 | .B [ | ||
| 20 | .I options | ||
| 21 | .B ] | ||
| 22 | |||
| 23 | -.B iperf -u -s [ | ||
| 24 | +.B iperf \-u \-s [ | ||
| 25 | .I options | ||
| 26 | .B ] | ||
| 27 | |||
| 28 | -.B iperf -u -c | ||
| 29 | +.B iperf \-u \-c | ||
| 30 | .I server | ||
| 31 | .B [ | ||
| 32 | .I options | ||
| 33 | @@ -28,103 +28,103 @@ | ||
| 34 | traffic). | ||
| 35 | .SH "GENERAL OPTIONS" | ||
| 36 | .TP | ||
| 37 | -.BR -f ", " --format " " | ||
| 38 | +.BR \-f ", " \-\-format " " | ||
| 39 | [kmKM] format to report: Kbits, Mbits, KBytes, MBytes | ||
| 40 | .TP | ||
| 41 | -.BR -h ", " --help " " | ||
| 42 | +.BR \-h ", " \-\-help " " | ||
| 43 | print a help synopsis | ||
| 44 | .TP | ||
| 45 | -.BR -i ", " --interval " \fIn\fR" | ||
| 46 | +.BR \-i ", " \-\-interval " \fIn\fR" | ||
| 47 | pause \fIn\fR seconds between periodic bandwidth reports | ||
| 48 | .TP | ||
| 49 | -.BR -l ", " --len " \fIn\fR[KM]" | ||
| 50 | +.BR \-l ", " \-\-len " \fIn\fR[KM]" | ||
| 51 | set length read/write buffer to \fIn\fR (default 8 KB) | ||
| 52 | .TP | ||
| 53 | -.BR -m ", " --print_mss " " | ||
| 54 | +.BR \-m ", " \-\-print_mss " " | ||
| 55 | print TCP maximum segment size (MTU - TCP/IP header) | ||
| 56 | .TP | ||
| 57 | -.BR -o ", " --output " <filename>" | ||
| 58 | +.BR \-o ", " \-\-output " <filename>" | ||
| 59 | output the report or error message to this specified file | ||
| 60 | .TP | ||
| 61 | -.BR -p ", " --port " \fIn\fR" | ||
| 62 | +.BR \-p ", " \-\-port " \fIn\fR" | ||
| 63 | set server port to listen on/connect to to \fIn\fR (default 5001) | ||
| 64 | .TP | ||
| 65 | -.BR -u ", " --udp " " | ||
| 66 | +.BR \-u ", " \-\-udp " " | ||
| 67 | use UDP rather than TCP | ||
| 68 | .TP | ||
| 69 | -.BR -w ", " --window " \fIn\fR[KM]" | ||
| 70 | +.BR \-w ", " \-\-window " \fIn\fR[KM]" | ||
| 71 | TCP window size (socket buffer size) | ||
| 72 | .TP | ||
| 73 | -.BR -B ", " --bind " <host>" | ||
| 74 | +.BR \-B ", " \-\-bind " <host>" | ||
| 75 | bind to <host>, an interface or multicast address | ||
| 76 | .TP | ||
| 77 | -.BR -C ", " --compatibility " " | ||
| 78 | +.BR \-C ", " \-\-compatibility " " | ||
| 79 | for use with older versions does not sent extra msgs | ||
| 80 | .TP | ||
| 81 | -.BR -M ", " --mss " \fIn\fR" | ||
| 82 | +.BR \-M ", " \-\-mss " \fIn\fR" | ||
| 83 | set TCP maximum segment size (MTU - 40 bytes) | ||
| 84 | .TP | ||
| 85 | -.BR -N ", " --nodelay " " | ||
| 86 | +.BR \-N ", " \-\-nodelay " " | ||
| 87 | set TCP no delay, disabling Nagle's Algorithm | ||
| 88 | .TP | ||
| 89 | -.BR -v ", " --version " " | ||
| 90 | +.BR \-v ", " \-\-version " " | ||
| 91 | print version information and quit | ||
| 92 | .TP | ||
| 93 | -.BR -V ", " --IPv6Version " " | ||
| 94 | +.BR \-V ", " \-\-IPv6Version " " | ||
| 95 | Set the domain to IPv6 | ||
| 96 | .TP | ||
| 97 | -.BR -x ", " --reportexclude " " | ||
| 98 | +.BR \-x ", " \-\-reportexclude " " | ||
| 99 | [CDMSV] exclude C(connection) D(data) M(multicast) S(settings) V(server) reports | ||
| 100 | .TP | ||
| 101 | -.BR -y ", " --reportstyle " C|c" | ||
| 102 | +.BR \-y ", " \-\-reportstyle " C|c" | ||
| 103 | if set to C or c report results as CSV (comma separated values) | ||
| 104 | .SH "SERVER SPECIFIC OPTIONS" | ||
| 105 | .TP | ||
| 106 | -.BR -s ", " --server " " | ||
| 107 | +.BR \-s ", " \-\-server " " | ||
| 108 | run in server mode | ||
| 109 | .TP | ||
| 110 | -.BR -U ", " --single_udp " " | ||
| 111 | +.BR \-U ", " \-\-single_udp " " | ||
| 112 | run in single threaded UDP mode | ||
| 113 | .TP | ||
| 114 | -.BR -D ", " --daemon " " | ||
| 115 | +.BR \-D ", " \-\-daemon " " | ||
| 116 | run the server as a daemon | ||
| 117 | .SH "CLIENT SPECIFIC OPTIONS" | ||
| 118 | .TP | ||
| 119 | -.BR -b ", " --bandwidth " \fIn\fR[KM]" | ||
| 120 | +.BR \-b ", " \-\-bandwidth " \fIn\fR[KM]" | ||
| 121 | set target bandwidth to \fIn\fR bits/sec (default 1 Mbit/sec). | ||
| 122 | -This setting requires UDP (-u). | ||
| 123 | +This setting requires UDP (\-u). | ||
| 124 | .TP | ||
| 125 | -.BR -c ", " --client " <host>" | ||
| 126 | +.BR \-c ", " \-\-client " <host>" | ||
| 127 | run in client mode, connecting to <host> | ||
| 128 | .TP | ||
| 129 | -.BR -d ", " --dualtest " " | ||
| 130 | +.BR \-d ", " \-\-dualtest " " | ||
| 131 | Do a bidirectional test simultaneously | ||
| 132 | .TP | ||
| 133 | -.BR -n ", " --num " \fIn\fR[KM]" | ||
| 134 | -number of bytes to transmit (instead of -t) | ||
| 135 | +.BR \-n ", " \-\-num " \fIn\fR[KM]" | ||
| 136 | +number of bytes to transmit (instead of \-t) | ||
| 137 | .TP | ||
| 138 | -.BR -r ", " --tradeoff " " | ||
| 139 | +.BR \-r ", " \-\-tradeoff " " | ||
| 140 | Do a bidirectional test individually | ||
| 141 | .TP | ||
| 142 | -.BR -t ", " --time " \fIn\fR" | ||
| 143 | +.BR \-t ", " \-\-time " \fIn\fR" | ||
| 144 | time in seconds to transmit for (default 10 secs) | ||
| 145 | .TP | ||
| 146 | -.BR -F ", " --fileinput " <name>" | ||
| 147 | +.BR \-F ", " \-\-fileinput " <name>" | ||
| 148 | input the data to be transmitted from a file | ||
| 149 | .TP | ||
| 150 | -.BR -I ", " --stdin " " | ||
| 151 | +.BR \-I ", " \-\-stdin " " | ||
| 152 | input the data to be transmitted from stdin | ||
| 153 | .TP | ||
| 154 | -.BR -L ", " --listenport " \fIn\fR" | ||
| 155 | +.BR \-L ", " \-\-listenport " \fIn\fR" | ||
| 156 | port to recieve bidirectional tests back on | ||
| 157 | .TP | ||
| 158 | -.BR -P ", " --parallel " \fIn\fR" | ||
| 159 | +.BR \-P ", " \-\-parallel " \fIn\fR" | ||
| 160 | number of parallel client threads to run | ||
| 161 | .TP | ||
| 162 | -.BR -T ", " --ttl " \fIn\fR" | ||
| 163 | +.BR \-T ", " \-\-ttl " \fIn\fR" | ||
| 164 | time-to-live, for multicast (default 1) | ||
| 165 | .TP | ||
| 166 | -.BR -Z ", " --linux-congestion " <algo>" | ||
| 167 | +.BR \-Z ", " \-\-linux\-congestion " <algo>" | ||
| 168 | set TCP congestion control algorithm (Linux only) | ||
| 169 | .SH ENVIRONMENT | ||
| 170 | .TP | ||
| 171 | @@ -143,6 +143,6 @@ | ||
| 172 | Kevin Gibbs, | ||
| 173 | John Estabrook <jestabro at ncsa.uiuc.edu>, | ||
| 174 | Andrew Gallatin <gallatin at gmail.com>, | ||
| 175 | -Stephen Hemminger <shemminger at linux-foundation.org> | ||
| 176 | +Stephen Hemminger <shemminger at linux\-foundation.org> | ||
| 177 | .SH "SEE ALSO" | ||
| 178 | http://iperf.sourceforge.net/ | ||
diff --git a/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/004-svn-r43-ro.patch b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/004-svn-r43-ro.patch new file mode 100644 index 0000000000..83401489ae --- /dev/null +++ b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/004-svn-r43-ro.patch | |||
| @@ -0,0 +1,117 @@ | |||
| 1 | Import Debian patches and fix a lot of real bugs. | ||
| 2 | |||
| 3 | Upstream-Status: Inappropriate [not author. Above message was get from oe.dev c10c33f86903c93611023197a7f812459c2dfe2d] | ||
| 4 | |||
| 5 | --- iperf-2.0.4-4/AUTHORS 2009-07-06 12:02:24.159696747 +0200 | ||
| 6 | +++ iperf-2.0.4/AUTHORS 2009-07-06 12:14:32.236079541 +0200 | ||
| 7 | @@ -28,3 +28,7 @@ | ||
| 8 | |||
| 9 | Stephen Hemminger <shemminger@linux-foundation.org> | ||
| 10 | * Linux congestion control selection and theading improvements | ||
| 11 | + | ||
| 12 | +Nathan Jones <nmjones@users.sourceforge.net> | ||
| 13 | + * patch for underflow when value specified in -n is not a multiple of -l | ||
| 14 | + | ||
| 15 | --- iperf-2.0.4-4/ChangeLog 2009-07-06 12:02:24.166276642 +0200 | ||
| 16 | +++ iperf-2.0.4/ChangeLog 2009-07-06 12:15:28.883699655 +0200 | ||
| 17 | @@ -1,3 +1,18 @@ | ||
| 18 | +2008-05-09 Jon Dugan <jdugan@x1024.net> | ||
| 19 | + | ||
| 20 | +* change currLen to unsigned to squelch warning generated by Nathan's patch | ||
| 21 | + | ||
| 22 | +2008-05-09 Nathan Jones <nmjones@users.sourceforge.net> | ||
| 23 | + | ||
| 24 | +* prevent underflow when the amount of data to be transmitted (-n) is not a | ||
| 25 | +multiple of the buffer size (-l) Patch: | ||
| 26 | +https://sourceforge.net/tracker/index.php?func=detail&aid=1943432&group_id=128336&atid=711373 | ||
| 27 | + | ||
| 28 | +2008-04-08 Jon Dugan <jdugan@x1024.net> | ||
| 29 | + | ||
| 30 | +* print report headers only once | ||
| 31 | +* use appropriate report header for UDP tests | ||
| 32 | + | ||
| 33 | 2008-04-07 Jon Dugan <jdugan@x1024.net> | ||
| 34 | |||
| 35 | * Add man page to autoconf goo | ||
| 36 | diff -urN 204orig/src/Client.cpp trunk/src/Client.cpp | ||
| 37 | --- 204orig/src/Client.cpp 2008-04-08 04:37:54.000000000 +0200 | ||
| 38 | +++ trunk/src/Client.cpp 2008-05-10 05:18:35.000000000 +0200 | ||
| 39 | @@ -116,7 +116,7 @@ | ||
| 40 | const int kBytes_to_Bits = 8; | ||
| 41 | |||
| 42 | void Client::RunTCP( void ) { | ||
| 43 | - long currLen = 0; | ||
| 44 | + unsigned long currLen = 0; | ||
| 45 | struct itimerval it; | ||
| 46 | max_size_t totLen = 0; | ||
| 47 | |||
| 48 | @@ -170,7 +170,12 @@ | ||
| 49 | } | ||
| 50 | |||
| 51 | if ( !mMode_Time ) { | ||
| 52 | - mSettings->mAmount -= currLen; | ||
| 53 | + /* mAmount may be unsigned, so don't let it underflow! */ | ||
| 54 | + if( mSettings->mAmount >= currLen ) { | ||
| 55 | + mSettings->mAmount -= currLen; | ||
| 56 | + } else { | ||
| 57 | + mSettings->mAmount = 0; | ||
| 58 | + } | ||
| 59 | } | ||
| 60 | |||
| 61 | } while ( ! (sInterupted || | ||
| 62 | @@ -198,7 +203,7 @@ | ||
| 63 | |||
| 64 | void Client::Run( void ) { | ||
| 65 | struct UDP_datagram* mBuf_UDP = (struct UDP_datagram*) mBuf; | ||
| 66 | - long currLen = 0; | ||
| 67 | + unsigned long currLen = 0; | ||
| 68 | |||
| 69 | int delay_target = 0; | ||
| 70 | int delay = 0; | ||
| 71 | @@ -310,7 +315,12 @@ | ||
| 72 | delay_loop( delay ); | ||
| 73 | } | ||
| 74 | if ( !mMode_Time ) { | ||
| 75 | - mSettings->mAmount -= currLen; | ||
| 76 | + /* mAmount may be unsigned, so don't let it underflow! */ | ||
| 77 | + if( mSettings->mAmount >= currLen ) { | ||
| 78 | + mSettings->mAmount -= currLen; | ||
| 79 | + } else { | ||
| 80 | + mSettings->mAmount = 0; | ||
| 81 | + } | ||
| 82 | } | ||
| 83 | |||
| 84 | } while ( ! (sInterupted || | ||
| 85 | diff -urN 204orig/src/ReportDefault.c trunk/src/ReportDefault.c | ||
| 86 | --- 204orig/src/ReportDefault.c 2008-04-08 04:37:54.000000000 +0200 | ||
| 87 | +++ trunk/src/ReportDefault.c 2008-04-09 02:08:11.000000000 +0200 | ||
| 88 | @@ -67,6 +67,7 @@ | ||
| 89 | * Prints transfer reports in default style | ||
| 90 | */ | ||
| 91 | void reporter_printstats( Transfer_Info *stats ) { | ||
| 92 | + static char header_printed = 0; | ||
| 93 | |||
| 94 | byte_snprintf( buffer, sizeof(buffer)/2, (double) stats->TotalLen, | ||
| 95 | toupper( stats->mFormat)); | ||
| 96 | @@ -76,13 +77,19 @@ | ||
| 97 | |||
| 98 | if ( stats->mUDP != (char)kMode_Server ) { | ||
| 99 | // TCP Reporting | ||
| 100 | - printf( report_bw_header); | ||
| 101 | + if( !header_printed ) { | ||
| 102 | + printf( report_bw_header); | ||
| 103 | + header_printed = 1; | ||
| 104 | + } | ||
| 105 | printf( report_bw_format, stats->transferID, | ||
| 106 | stats->startTime, stats->endTime, | ||
| 107 | buffer, &buffer[sizeof(buffer)/2] ); | ||
| 108 | } else { | ||
| 109 | // UDP Reporting | ||
| 110 | - printf( report_bw_jitter_loss_header); | ||
| 111 | + if( !header_printed ) { | ||
| 112 | + printf( report_bw_jitter_loss_header); | ||
| 113 | + header_printed = 1; | ||
| 114 | + } | ||
| 115 | printf( report_bw_jitter_loss_format, stats->transferID, | ||
| 116 | stats->startTime, stats->endTime, | ||
| 117 | buffer, &buffer[sizeof(buffer)/2], | ||
diff --git a/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/005-iperf-die-on-bind-fail.patch b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/005-iperf-die-on-bind-fail.patch new file mode 100644 index 0000000000..ec13d6b165 --- /dev/null +++ b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/005-iperf-die-on-bind-fail.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | Import Debian patches and fix a lot of real bugs. | ||
| 2 | |||
| 3 | Upstream-Status: Inappropriate [not author. Above message was get from oe.dev c10c33f86903c93611023197a7f812459c2dfe2d] | ||
| 4 | |||
| 5 | --- iperf-2.0.4/src/Listener.cpp 2009-02-23 16:20:31.000000000 -0500 | ||
| 6 | +++ iperf-2.0.4-fixed/src/Listener.cpp 2009-02-23 16:20:40.000000000 -0500 | ||
| 7 | @@ -333,7 +333,7 @@ | ||
| 8 | #endif | ||
| 9 | { | ||
| 10 | rc = bind( mSettings->mSock, (sockaddr*) &mSettings->local, mSettings->size_local ); | ||
| 11 | - WARN_errno( rc == SOCKET_ERROR, "bind" ); | ||
| 12 | + FAIL_errno( rc == SOCKET_ERROR, "bind", mSettings ); | ||
| 13 | } | ||
| 14 | // listen for connections (TCP only). | ||
| 15 | // default backlog traditionally 5 | ||
diff --git a/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/006-iperf-die-on-connect-fail.patch b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/006-iperf-die-on-connect-fail.patch new file mode 100644 index 0000000000..9e17e6de91 --- /dev/null +++ b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/006-iperf-die-on-connect-fail.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | Import Debian patches and fix a lot of real bugs. | ||
| 2 | |||
| 3 | Upstream-Status: Inappropriate [not author. Above message was get from oe.dev c10c33f86903c93611023197a7f812459c2dfe2d] | ||
| 4 | |||
| 5 | --- iperf-2.0.4/src/Client.cpp 2008-04-07 22:37:54.000000000 -0400 | ||
| 6 | +++ iperf-2.0.4-fixed/src/Client.cpp 2009-03-03 12:30:02.000000000 -0500 | ||
| 7 | @@ -403,7 +403,7 @@ | ||
| 8 | // connect socket | ||
| 9 | rc = connect( mSettings->mSock, (sockaddr*) &mSettings->peer, | ||
| 10 | SockAddr_get_sizeof_sockaddr( &mSettings->peer )); | ||
| 11 | - WARN_errno( rc == SOCKET_ERROR, "connect" ); | ||
| 12 | + FAIL_errno( rc == SOCKET_ERROR, "connect", mSettings ); | ||
| 13 | |||
| 14 | getsockname( mSettings->mSock, (sockaddr*) &mSettings->local, | ||
| 15 | &mSettings->size_local ); | ||
diff --git a/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/007-iperf-reporter-deadlock.patch b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/007-iperf-reporter-deadlock.patch new file mode 100644 index 0000000000..4b5f914b85 --- /dev/null +++ b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/007-iperf-reporter-deadlock.patch | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | by Kirby Zhou < kirbyzhou \x40 sohu-rd.com > | ||
| 2 | add a Condition_Wait_Event for ReporterDoneCond | ||
| 3 | |||
| 4 | Upstream-Status: Inappropriate [not author] | ||
| 5 | |||
| 6 | --- iperf-2.0.4.orig/include/Condition.h 2007-08-30 00:06:19.000000000 +0200 | ||
| 7 | +++ iperf-2.0.4/include/Condition.h 2009-07-06 11:45:02.407700310 +0200 | ||
| 8 | @@ -115,6 +115,11 @@ typedef struct Condition { | ||
| 9 | // sleep this thread, waiting for condition signal | ||
| 10 | #if defined( HAVE_POSIX_THREAD ) | ||
| 11 | #define Condition_Wait( Cond ) pthread_cond_wait( &(Cond)->mCondition, &(Cond)->mMutex ) | ||
| 12 | + #define Condition_Wait_Event( Cond ) do { \ | ||
| 13 | + Mutex_Lock( &(Cond)->mMutex ); \ | ||
| 14 | + pthread_cond_wait( &(Cond)->mCondition, &(Cond)->mMutex ); \ | ||
| 15 | + Mutex_Unlock( &(Cond)->mMutex ); \ | ||
| 16 | + } while ( 0 ) | ||
| 17 | #elif defined( HAVE_WIN32_THREAD ) | ||
| 18 | // atomically release mutex and wait on condition, | ||
| 19 | // then re-acquire the mutex | ||
| 20 | @@ -122,6 +127,10 @@ typedef struct Condition { | ||
| 21 | SignalObjectAndWait( (Cond)->mMutex, (Cond)->mCondition, INFINITE, false ); \ | ||
| 22 | Mutex_Lock( &(Cond)->mMutex ); \ | ||
| 23 | } while ( 0 ) | ||
| 24 | + #define Condition_Wait_Event( Cond ) do { \ | ||
| 25 | + Mutex_Lock( &(Cond)->mMutex ); \ | ||
| 26 | + SignalObjectAndWait( (Cond)->mMutex, (Cond)->mCondition, INFINITE, false ); \ | ||
| 27 | + } while ( 0 ) | ||
| 28 | #else | ||
| 29 | #define Condition_Wait( Cond ) | ||
| 30 | #endif | ||
| 31 | --- iperf-2.0.4.orig/src/Reporter.c 2009-07-06 11:49:05.996443011 +0200 | ||
| 32 | +++ iperf-2.0.4/src/Reporter.c 2009-07-06 11:46:52.919699530 +0200 | ||
| 33 | @@ -339,7 +339,7 @@ void ReportPacket( ReportHeader* agent, | ||
| 34 | // item | ||
| 35 | while ( index == 0 ) { | ||
| 36 | Condition_Signal( &ReportCond ); | ||
| 37 | - Condition_Wait( &ReportDoneCond ); | ||
| 38 | + Condition_Wait_Event( &ReportDoneCond ); | ||
| 39 | index = agent->reporterindex; | ||
| 40 | } | ||
| 41 | agent->agentindex = 0; | ||
| 42 | @@ -347,7 +347,7 @@ void ReportPacket( ReportHeader* agent, | ||
| 43 | // Need to make sure that reporter is not about to be "lapped" | ||
| 44 | while ( index - 1 == agent->agentindex ) { | ||
| 45 | Condition_Signal( &ReportCond ); | ||
| 46 | - Condition_Wait( &ReportDoneCond ); | ||
| 47 | + Condition_Wait_Event( &ReportDoneCond ); | ||
| 48 | index = agent->reporterindex; | ||
| 49 | } | ||
| 50 | |||
| 51 | @@ -391,7 +391,7 @@ void EndReport( ReportHeader *agent ) { | ||
| 52 | if ( agent != NULL ) { | ||
| 53 | int index = agent->reporterindex; | ||
| 54 | while ( index != -1 ) { | ||
| 55 | - Condition_Wait( &ReportDoneCond ); | ||
| 56 | + Condition_Wait_Event( &ReportDoneCond ); | ||
| 57 | index = agent->reporterindex; | ||
| 58 | } | ||
| 59 | agent->agentindex = -1; | ||
| 60 | @@ -412,7 +412,7 @@ void EndReport( ReportHeader *agent ) { | ||
| 61 | Transfer_Info *GetReport( ReportHeader *agent ) { | ||
| 62 | int index = agent->reporterindex; | ||
| 63 | while ( index != -1 ) { | ||
| 64 | - Condition_Wait( &ReportDoneCond ); | ||
| 65 | + Condition_Wait_Event( &ReportDoneCond ); | ||
| 66 | index = agent->reporterindex; | ||
| 67 | } | ||
| 68 | return &agent->report.info; | ||
diff --git a/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/008-numofreport.patch b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/008-numofreport.patch new file mode 100644 index 0000000000..c5d85b1b54 --- /dev/null +++ b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/008-numofreport.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | by Kirby Zhou < kirbyzhou \x40 sohu-rd.com > | ||
| 2 | increase the queue length to avoid thread racing | ||
| 3 | |||
| 4 | Upstream-Status: Inappropriate [not author] | ||
| 5 | --- iperf-2.0.4.orig/include/Reporter.h 2008-04-08 04:37:54.000000000 +0200 | ||
| 6 | +++ iperf-2.0.4/include/Reporter.h 2009-07-06 11:53:58.700541554 +0200 | ||
| 7 | @@ -61,7 +61,7 @@ struct server_hdr; | ||
| 8 | |||
| 9 | #include "Settings.hpp" | ||
| 10 | |||
| 11 | -#define NUM_REPORT_STRUCTS 700 | ||
| 12 | +#define NUM_REPORT_STRUCTS 5700 | ||
| 13 | #define NUM_MULTI_SLOTS 5 | ||
| 14 | |||
| 15 | #ifdef __cplusplus | ||
diff --git a/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/009-delayloop.patch b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/009-delayloop.patch new file mode 100644 index 0000000000..a2a0797501 --- /dev/null +++ b/meta-oe/recipes-benchmark/iperf/iperf-2.0.4/009-delayloop.patch | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | by Kirby Zhou < kirbyzhou \x40 sohu-rd.com > | ||
| 2 | using sched_yield to schedule other threads, so multiple iperf can run simultaneously | ||
| 3 | using usleep with delay-loop between 2 package is long than 1.25ms. | ||
| 4 | |||
| 5 | Upstream-Status: Inappropriate [not author] | ||
| 6 | |||
| 7 | --- iperf-2.0.4-4/compat/delay.cpp 2009-07-06 12:02:24.166276642 +0200 | ||
| 8 | +++ iperf-2.0.4/compat/delay.cpp 2009-07-06 12:01:33.858384005 +0200 | ||
| 9 | @@ -69,6 +69,13 @@ void delay_loop( unsigned long usec ) { | ||
| 10 | |||
| 11 | Timestamp now; | ||
| 12 | while ( now.before( end ) ) { | ||
| 13 | + long diff = end.subUsec(now); | ||
| 14 | + if (diff >= 1250) { | ||
| 15 | + usleep(0); | ||
| 16 | + } | ||
| 17 | + if (diff >= 2) { | ||
| 18 | + sched_yield(); | ||
| 19 | + } | ||
| 20 | now.setnow(); | ||
| 21 | } | ||
| 22 | } | ||
diff --git a/meta-oe/recipes-benchmark/iperf/iperf_2.0.4.bb b/meta-oe/recipes-benchmark/iperf/iperf_2.0.4.bb new file mode 100644 index 0000000000..bd8bac126b --- /dev/null +++ b/meta-oe/recipes-benchmark/iperf/iperf_2.0.4.bb | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | DESCRIPTION = "Iperf is a tool to measure maximum TCP bandwidth, allowing the tuning of various parameters and UDP characteristics" | ||
| 2 | HOMEPAGE = "http://dast.nlanr.net/Projects/Iperf/" | ||
| 3 | SECTION = "console/network" | ||
| 4 | LICENSE = "NewBSD" | ||
| 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=e8478eae9f479e39bc34975193360298" | ||
| 6 | |||
| 7 | SRC_URI = " \ | ||
| 8 | ${SOURCEFORGE_MIRROR}/iperf/iperf-${PV}.tar.gz \ | ||
| 9 | file://000-Iperf_Fix-CPU-Usage.diff \ | ||
| 10 | file://001-cast-to-max_size_t-instead-of-int.patch \ | ||
| 11 | file://003-fix-hyphen-used-as-minus-sign.patch \ | ||
| 12 | file://004-svn-r43-ro.patch \ | ||
| 13 | file://005-iperf-die-on-bind-fail.patch \ | ||
| 14 | file://006-iperf-die-on-connect-fail.patch \ | ||
| 15 | file://007-iperf-reporter-deadlock.patch \ | ||
| 16 | file://008-numofreport.patch \ | ||
| 17 | file://009-delayloop.patch \ | ||
| 18 | " | ||
| 19 | |||
| 20 | |||
| 21 | SRC_URI[md5sum] = "8c5bc14cc2ea55f18f22afe3c23e3dcb" | ||
| 22 | SRC_URI[sha256sum] = "3b52f1c178d6a99c27114929d5469c009197d15379c967b329bafb956f397944" | ||
| 23 | |||
| 24 | inherit autotools | ||
| 25 | |||
| 26 | S="${WORKDIR}/iperf-${PV}" | ||
| 27 | |||
| 28 | EXTRA_OECONF = "--exec-prefix=${STAGING_DIR_HOST}${layout_exec_prefix}" | ||
| 29 | |||
| 30 | do_configure() { | ||
| 31 | export ac_cv_func_malloc_0_nonnull=yes | ||
| 32 | gnu-configize | ||
| 33 | oe_runconf | ||
| 34 | } | ||
| 35 | |||
| 36 | do_compile() { | ||
| 37 | cd ${WORKDIR}/iperf-${PV} | ||
| 38 | oe_runmake | ||
| 39 | } | ||
| 40 | |||
| 41 | do_install() { | ||
| 42 | cd ${WORKDIR}/iperf-${PV}/src | ||
| 43 | oe_runmake DESTDIR=${D} install | ||
| 44 | } | ||
| 45 | |||
| 46 | |||
