性能测试工具CBench


Cbench 安装,Controller Benchmarker,openflow,oflops ,测试openflow控制器性能工具,发送packet-in消息,统计及计算性能指标
资源截图
代码片段和文件信息
#include 
#include 
#include 
#include 
#include 

#include 

#include 
#include 
#include 

#include 
#include 


#include “channel_info.h“
#include “utils.h“

int channel_info_init(struct channel_info * channel char * dev)
{
struct ifreq ifr;
int dumb;
char *tmp;

bzero(channel sizeof(channel_info));
if((tmp = index(dev ‘:‘)) != NULL) {
  *tmp = ‘‘;
  tmp++;
  channel->of_port = atoi(tmp);
} else {
  channel->of_port = -1;
}
channel->inOID_len = MAX_OID_LEN;
channel->outOID_len = MAX_OID_LEN;
channel->dev = strdup(dev);
channel->pcap_fd = -1;
channel->raw_sock = -1;
channel->sock = -1;
channel->dump = NULL;

/* Not sure why I need a socket to do this */
dumb = socket(AF_INET SOCK_STREAM 0);

/*retrieve ethernet interface index*/
strncpy(ifr.ifr_name dev IFNAMSIZ);
if (ioctl(dumb SIOCGIFINDEX &ifr) == -1) 
perror_and_exit(“SIOCGIFINDEX“1);

channel->ifindex = ifr.ifr_ifindex;
channel->packet_len = 0;
    channel->outgoing = msgbuf_new(4096);   // will get resized
    channel->det = NULL;
    close(dumb);
    return 0;
}

/****************************************************
 * query module if they want pcap and set it up for them if yes
 * also create a raw_socket bound to each device if we have the
 * device set
 */


void setup_channel(oflops_context *ctx test_module *mod oflops_channel_name ch )
{
char buf[BUFLEN];
char errbuf[PCAP_ERRBUF_SIZE];
struct bpf_program filter;
bpf_u_int32 mask=0 net=0;

channel_info *ch_info = &ctx->channels[ch];


if(ch_info->dev==NULL) // no device specified
{
ch_info->dev = pcap_lookupdev(errbuf);
fprintf(stderr“%s channel %i not configured; guessing device: “
((ch==OFLOPS_CONTROL)?“Control“:“Data“) ch);
if(ch_info->dev)
fprintf(stderr“%s“ch_info->dev);
else
{
fprintf(stderr “ pcap_lookup() failed: %s ; exiting....
“ errbuf);
exit(1);
}
}

// setup pcap filter if wanted
if( mod->get_pcap_filter(ctxchbufBUFLEN) <=0)
{
fprintf(stderr “Test %s:  No pcap filter for channel %d on %s

mod->name() ch ch_info->dev);
ch_info->pcap_handle=NULL;
return;
}
assert(ch_info->dev); // need to have someting here
fprintf(stderr“Test %s:  Starting pcap filter “%s“ on dev %s for channel %d

mod->name() buf ch_info->dev ch);
errbuf[0]=0;
if(ch != OFLOPS_CONTROL) {
ch_info->pcap_handle = pcap_open_live(
ch_info->dev
ctx->snaplen
1  // promisc
0  // read timeout (ms)
errbuf // for error messages
);
} else {
  ch_info->pcap_handle = pcap_open_live(ch_info->dev6500010errbuf);
  if(ctx->dump_controller) { 
    ch_info->dump = pcap_dump_open(ch_info->pcap_handle “controller.pcap“);
    printf(“XXXXXXXXXXXXXXXX Dumping controller channel to to file
“);
  } else {
    ch_info->dump = NULL;
    printf(“XXXXXXXXXXXXXX not dumping con

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-06-03 08:44  oflops
     文件         695  2016-06-02 13:16  oflopsTODO
     目录           0  2016-06-02 13:16  oflopsm4
     文件         271  2016-06-02 13:16  oflopsm4ac_pkg_doxygen.m4
     文件        3759  2016-06-02 13:16  oflopsmsgbuf.c
     目录           0  2016-06-02 13:16  oflopsdoc
     文件        1557  2016-06-02 13:16  oflopsdocMakefile
     文件       63661  2016-06-02 13:16  oflopsdocdoxygen.conf.in
     文件         938  2016-06-02 13:16  oflopschannel_info.h
     文件         977  2016-06-02 13:16  oflopsconfig-openvswitch-flow-stats.cfg
     文件         163  2016-06-02 13:16  oflops.gitmodules
     目录           0  2016-06-03 08:47  oflops
etfpga-packet-generator-c-library
     目录           0  2016-06-03 08:47  oflops
etfpga-packet-generator-c-librarysrc
     文件        1532  2016-06-03 08:47  oflops
etfpga-packet-generator-c-librarysrcutil.c
     文件         440  2016-06-03 08:47  oflops
etfpga-packet-generator-c-librarysrcutil.h
     文件       16186  2016-06-03 08:47  oflops
etfpga-packet-generator-c-librarysrc
f2.h
     文件         264  2016-06-03 08:47  oflops
etfpga-packet-generator-c-librarysrcMakefile.am
     文件        1916  2016-06-03 08:47  oflops
etfpga-packet-generator-c-librarysrc
f2util.h
     文件       21220  2016-06-03 08:47  oflops
etfpga-packet-generator-c-librarysrc
f2util.c
     文件       57165  2016-06-03 08:47  oflops
etfpga-packet-generator-c-librarysrc
eg_defines_packet_generator.h
     文件        1010  2016-06-03 08:47  oflops
etfpga-packet-generator-c-librarysrcconstants.h
     文件       47420  2016-06-03 08:47  oflops
etfpga-packet-generator-c-librarysrc
eg_defines.h
     文件       47308  2016-06-03 08:47  oflops
etfpga-packet-generator-c-librarysrc
f_pktgen.c
     目录           0  2016-06-03 08:47  oflops
etfpga-packet-generator-c-libraryinclude
     文件           0  2016-06-03 08:47  oflops
etfpga-packet-generator-c-libraryinclude
f_cap.h
     文件        1535  2016-06-03 08:47  oflops
etfpga-packet-generator-c-libraryinclude
f_pktgen.h
     文件           0  2016-06-03 08:47  oflops
etfpga-packet-generator-c-libraryinclude
f_gen.h
     文件     2377746  2016-06-03 08:47  oflops
etfpga-packet-generator-c-libraryoflops_packet_generator.bit
     文件          97  2016-06-03 08:47  oflops
etfpga-packet-generator-c-libraryMakefile.am
     文件         770  2016-06-03 08:47  oflops
etfpga-packet-generator-c-libraryconfigure.in
     文件          99  2016-06-03 08:47  oflops
etfpga-packet-generator-c-libraryautogen.sh
............此处省略1205个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)