#include #include #include #include #include #include #include #include #include #include void err(char*buf) { printf("%s\n", buf); _exit(1); } #undef HAVE_DEBUG #undef HAVE_NOCRYPTO #undef HAVE_NOCACHE #define HAVE_NOHASH #include "utils.h" #include "table.h" #include "tree.h" #include "types.h" #include "p4emu_hdr.h" #include "p4emu_tab.h" #include "p4emu_fwd.h" #include "p4emu_msg.h" #include "p4tester.h" int allocPack(void** scar, unsigned char **bufD, int bufS, void* ctx) { *scar = NULL; *bufD = malloc(bufS); return *bufD == NULL; } int sendPack(void* scar, unsigned char *bufD, int bufS, int port) { return 0; } void setMtu(int port, int mtu) { } void setState(int port, int sta) { } int getState(int port) { return 1; } void getStats(int port, unsigned char*buf, unsigned char*pre, int*len) { } int main(int argc, char **argv) { unsigned char origD[16384]; dataPorts = 1; cpuPort = 1; initIface(0, "bench"); initTables(); struct packetContext ctx; ctx.stat = ifaceStat[0]; initContext(&ctx); fflush(stdout); int origS = 0; if (argc < 3) err("usage: "); readTestCommands(argv[1], &ctx); origS = readTestBytes(argv[2], origD); __llvm_profile_reset_counters(); for (int i = 0; i < 1024; i++) { memcpy(&ctx.bufD[preBuff], &origD[0], origS); processDataPacket(&ctx, origS, 0); } __llvm_profile_set_filename(argv[3]); }