/*---------------------------------------------------------------
* Copyright (c) 1999,2000,2001,2002,2003
* The Board of Trustees of the University of Illinois
* All Rights Reserved.
*---------------------------------------------------------------
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software (Iperf) and associated
* documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
*
* Redistributions of source code must retain the above
* copyright notice, this list of conditions and
* the following disclaimers.
*
*
* Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimers in the documentation and/or other materials
* provided with the distribution.
*
*
* Neither the names of the University of Illinois, NCSA,
* nor the names of its contributors may be used to endorse
* or promote products derived from this Software without
* specific prior written permission.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTIBUTORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ________________________________________________________________
* National Laboratory for Applied Network Research
* National Center for Supercomputing Applications
* University of Illinois at Urbana-Champaign
* http://www.ncsa.uiuc.edu
* ________________________________________________________________
*
* Reporter.c
* by Kevin Gibbs <kgibbs@nlanr.net>
*
* ________________________________________________________________ */
#include "headers.h"
#include "Settings.hpp"
#include "util.h"
#include "Reporter.h"
#include "Thread.h"
#include "Locale.h"
#include "PerfSocket.hpp"
#include "SocketAddr.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
The following 4 functions are provided for Reporting
styles that do not have all the reporting formats. For
instance the provided CSV format does not have a settings
report so it uses settings_notimpl.
*/
void* connection_notimpl( Connection_Info * nused, int nuse ) {
return NULL;
}
void settings_notimpl( ReporterData * nused ) { }
void statistics_notimpl( Transfer_Info * nused ) { }
void serverstatistics_notimpl( Connection_Info *nused1, Transfer_Info *nused2 ) { }
// To add a reporting style include its header here.
#include "report_default.h"
#include "report_CSV.h"
// The following array of report structs contains the
// pointers required for reporting in different reporting
// styles. To add a reporting style add a report struct
// below.
report_connection connection_reports[kReport_MAXIMUM] = {
reporter_reportpeer,
CSV_peer
};
report_settings settings_reports[kReport_MAXIMUM] = {
reporter_reportsettings,
settings_notimpl
};
report_statistics statistics_reports[kReport_MAXIMUM] = {
reporter_printstats,
CSV_stats
};
report_serverstatistics serverstatistics_reports[kReport_MAXIMUM] = {
reporter_serverstats,
CSV_serverstats
};
report_statistics multiple_reports[kReport_MAXIMUM] = {
reporter_multistats,
CSV_stats
};
char buffer[64]; // Buffer for printing
ReportHeader *ReportRoot = NULL;
extern Condition ReportCond;
extern Condition ReportDoneCond;
int reporter_process_report ( ReportHeader *report );
void process_report ( ReportHeader *report );
int reporter_handle_packet( ReportHeader *report );
int reporter_condprintstats( ReporterData *stats, MultiHeader *multireport, int force );
int reporter_print( ReporterData *stats, int type, int end );
void PrintMSS( ReporterData *stats );
MultiHeader* InitMulti( thread_Settings *agent, int inID ) {
MultiHeader *multihdr = NULL;
if ( agent->mThreads > 1 || agent->mThreadMode == kMode_Server ) {
if ( isMultipleReport( agent ) ) {
multihdr = malloc(sizeof(MultiHeader) + sizeof(ReporterData) +
NUM_MULTI_SLOTS * sizeof(Transfer_Info));
} else {
multihdr = malloc(sizeof(MultiHeader));
}
if ( multihdr != NULL ) {
memset( multihdr, 0, sizeof(MultiHeader) );
Condition_Initialize( &multihdr->barrier );
multihdr->groupID = inID;
multihdr->threads = agent->mThreads;
if ( isMultipleReport( agent ) ) {
int i;
ReporterData *data = NULL;
multihdr->report = (ReporterData*)(multihdr + 1);
memset(multihdr->report, 0, sizeof(ReporterData));
multihdr->data = (Transfer_Info*)(multihdr->report + 1);
data = multihdr->report;
for ( i = 0; i < NUM_MULTI_SLOTS; i++ ) {
multihdr->data[i].startTime = -1;
multihdr->data[i].transferID = inID;
multihdr->data[i].groupID = -2;
}
data->type = TRANSFER_REPORT;
if ( agent->mInterval != 0.0 ) {
struct timeval *interval = &data->intervalTime;
interval->tv_sec = (long) agent->mInterval;
interval->tv_usec = (long) ((agent->mInterval - interval->tv_sec)
* rMillion);
}
data->mHost = agent->mHost;
data->mLocalhost = agent->mLocalhost;
data->mBufLen = agent->mBufLen;
data->mMSS = agent->mMSS;
data->mTCPWin = agent->mTCPWin;
data->flags = agent->flags;
data->mThreadMode = agent->mThreadMode;
data->mode = agent->mReportMode;
data->info.mFormat = agent->mFormat;
data->info.mTTL = agent->mTTL;
if ( isUDP( agent ) ) {
multihdr->report->info.mUDP = (char)agent->mThreadMode;
}
if ( isConnectionReport( agent ) ) {
data->type |= CONNECTION_REPORT;
data->connection.peer = agent->peer;
data->connection.size_peer = agent->size_peer;
SockAddr_setPortAny( &data->connection.peer );
data->connection.local = agent->local;
data->connection.size_local = agent->size_local;
SockAddr_setPortAny( &data->connection.local );
}
}
} else {
FAIL(1, "Out of Memory!!\n", agent);
}
}
return multihdr;
}
/*
* BarrierClient allows for multiple stream clients to be syncronized
*/
void BarrierClient( ReportHeader *agent ) {
Condition_Lock(agent->multireport->barrier);
agent->multireport->threads--;
if ( agent->multireport->threads == 0 ) {
// last one set time and wake up everyone
gettimeofday( &(agent->multireport->startTime), NULL );
Condition_Broadcast( &agent->multireport->barrier );
} else {
Condition_Wait( &agent->multireport->barrier );
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
iperf vs2010工程编译 (207个子文件)
iperf.1 4KB
configure.ac 8KB
Makefile.am 713B
Makefile.am 421B
Makefile.am 379B
Makefile.am 220B
Makefile.am 49B
Makefile.am 47B
AUTHORS 815B
Reporter.c 35KB
gnu_getopt.c 29KB
SocketAddr.c 15KB
Thread.c 15KB
Locale.c 12KB
ReportDefault.c 11KB
stdio.c 9KB
error.c 8KB
signal.c 7KB
sockets.c 6KB
tcp_window_size.c 6KB
ReportCSV.c 6KB
inet_pton.c 6KB
inet_ntop.c 5KB
Extractor.c 5KB
gnu_getopt_long.c 4KB
snprintf.c 3KB
gettimeofday.c 3KB
string.c 3KB
nanosleep.c 2KB
ChangeLog 3KB
configure 265KB
COPYING 2KB
setitimer.cpp 42KB
Settings.cpp 32KB
Listener.cpp 26KB
service.cpp 17KB
Client.cpp 16KB
main.cpp 11KB
Server.cpp 9KB
Launch.cpp 6KB
PerfSocket.cpp 6KB
List.cpp 4KB
delay.cpp 3KB
depcomp 15KB
iperf.exe 55KB
libpthread.exp 12KB
iperf.vcxproj.filters 6KB
dast.gif 5KB
config.guess 43KB
pstdint.h 904KB
pthread.h 10KB
config.h 8KB
Reporter.h 8KB
util.h 7KB
Condition.h 7KB
headers.h 6KB
Locale.h 5KB
Thread.h 5KB
service.h 5KB
gnu_getopt.h 5KB
setitimer.h 4KB
SocketAddr.h 4KB
Mutex.h 4KB
Extractor.h 4KB
inet_aton.h 4KB
pthread_types.h 4KB
List.h 3KB
gettimeofday.h 3KB
report_default.h 3KB
report_CSV.h 3KB
config.win32.h 2KB
pthread_clock.h 2KB
headers_slim.h 1KB
snprintf.h 1KB
iperf-int.h 263B
version.h 71B
Settings.hpp 16KB
Timestamp.hpp 10KB
Listener.hpp 3KB
Client.hpp 3KB
Server.hpp 3KB
PerfSocket.hpp 3KB
delay.hpp 3KB
index.html 41KB
ui_license.html 3KB
Makefile.in 19KB
Makefile.in 16KB
Makefile.in 14KB
Makefile.in 10KB
Makefile.in 9KB
Makefile.in 8KB
config.h.in 7KB
INSTALL 304B
install-sh 9KB
iperf.lastbuildstate 77B
libpthread.lib 41KB
iperf.log 15KB
iperf.Build.CppClean.log 3KB
aclocal.m4 30KB
ax_create_stdint_h.m4 23KB
共 207 条
- 1
- 2
- 3
fml927
- 粉丝: 37
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页