亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? hyper.cpp

?? 包分類算法Hypercuts算法
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/*
The code is contructed by Borland C++ v5.02 and C++ BuilderX.
I hope to release a GCC version in a short time.
The file formats of filter database and trace are come from ClassBench.

  There are five parameters to control the construction of decision tree.
  
1) common_filter_extraction (defined in hyper.h)
	The most important optimization skill in HyperCuts. It extracts the common filters in all branches.
	To avoid a long filter list for linear search, we apply the common_bucket_size to restrict its maximal length.
	
	Also, we force to generate cuts on multiple dimensions as the number of filters is large.
	This is because adopting only one-dimensional cuts might incur replication of a huge number of filters with wildcard on that dimension.
	Applying cuts on both dimensions could alleviate such condition.
	  
2) redundant_removal (defined in hyper.h)
	If the categoried filters in different branches are identical, these two branches are merged.
	However, the space corresponding to these filters are augumented.
	In the worst case, the resulted space might be identical to the original space before performing cutting.
	In such a case, we should abort the construction since the phenomenon will result in an infinite loop.
		
	In our experiments, the optimization may cause a performance degradation since the occupied space of
	the resulted filters cannot be reduced fast.
		  
3) cut_threshold (defined in hyper.h)
   If the number of cuts is less than cut_threshold, the construction procedure is stopped.
			
4) spfac (input by argument)
	Space factor, control the maximal number of generated branches.
			  
5) common_bucket_size (input by argument)
	Control the maximal number of filters in bucket. These filters are searched by using linear search.
				
The region compaction is also implemented in the codes; however, it seems not very effective.
				  
	If you have any idea to improve our codes, please let me know! Thank you.
	My email address is: pcwang@csie.nctu.edu.tw
*/

#include "hyper.h"

#define information_2

UINT node_count=0, branch_count=0, filters_count=0, spfac, common_bucket_size;
char *filter_file, *trace_file;

int main(int argc, char * argv[]) {
	int i, j;
	void hyper(filter *);
	filter *filters=NULL, *current;
	original_filter *original_filters;
	
	if ( argc <5) {
	printf("Execution: hyper.exe spfac common_bucket_size filter trace\n\n");
	printf("For example: hyper.exe 1 64 filter.txt filter.txt_trace");
	return 0;
	}
	
	  spfac = atoi(argv[1]);
	  common_bucket_size =atoi(argv[2]);
	  filter_file=argv[3];
	  trace_file=argv[4];
	
	
/*	spfac = 1;
	common_bucket_size =72;
	filter_file="my.rtf";
	trace_file="my_trace.rtf";
*/	
	/*if ( argc > 1 ) {
	spfac = atoi( argv[1] );
	if ( argc > 2)
	common_bucket_size =atoi(argv[2]);
	else
	common_bucket_size =0;
	}
	else {
	spfac = 1;
	common_bucket_size =64;
	}
	*/
#ifdef information_2
	time_t t;
	struct tm * area;
	t = time( NULL );
	area = localtime( & t );
	// printf( "Parameter:  spfac %d, common bucket size %d\n", spfac, common_bucket_size );
	// printf( "Size of each filter: %d, header: %d", sizeof( original_filter ), sizeof( header ) );
	//  printf( ", local time is: %s", asctime( area ) );
#endif
	
	original_filter *transform_filter(int *);
	original_filters=transform_filter(&i);
	
	// Transfer the filter format of ClassBench into a generalized form
	for (j=0; j<i; j++) {
		if (filters==NULL) {
			filters=(filter *)calloc(1, sizeof(filter));
			current=filters;
		}
		else {
			current->next=(filter *)calloc(1, sizeof(filter));
			current=current->next;
		}
		current->start[0]=original_filters[j].sa;
		current->end[0]=original_filters[j].sa+pow(2, 32-original_filters[j].sa_len)-1;
		current->start[1]=original_filters[j].da;
		current->end[1]=original_filters[j].da+pow(2, 32-original_filters[j].da_len)-1;
		current->start[2]=original_filters[j].sp[0];
		current->end[2]=original_filters[j].sp[1];
		current->start[3]=original_filters[j].dp[0];
		current->end[3]=original_filters[j].dp[1];
		
		if (original_filters[j].prot_num > 0)
			current->start[4]=current->end[4]=original_filters[j].prot_num;
		else {
			current->start[4]=0;
			current->end[4]=255;
		}
		
		if (original_filters[j].flags_mask > 0)
			current->start[5]=current->end[5]=original_filters[j].flags;
		else {
			current->start[5]=0;
			current->end[5]=65535;
		}
	}
	
	UINT k=0;
	for (current=filters; current!=NULL; current=current->next) {
		current->id=k;
		k++;
	}
	printf( "Parameter:  spfac %d, common bucket size %d\n", spfac, common_bucket_size );
	//  printf("Original Filters: %d, Current Filters: %d, ", i, k);
	//original_filter的內(nèi)存空間沒有釋放,釋放它的空間
	//修改時間:08.2.28
	free(original_filters);
	//讀取規(guī)則的過程:首先在函數(shù)read_filters()從文件中讀取規(guī)則庫,數(shù)據(jù)結(jié)構(gòu)是FilteList,是鏈表形式的,
	//然后在函數(shù)transform_filter,將鏈表形式的規(guī)則庫轉(zhuǎn)化為數(shù)組形式的,數(shù)據(jù)結(jié)構(gòu)是original_filter的,返回函數(shù)main
	//第三步又將數(shù)組形式的規(guī)則庫轉(zhuǎn)化為范圍形式的鏈表規(guī)則,數(shù)據(jù)結(jié)構(gòu)是filter,main函數(shù)運(yùn)行到此處
	//hyper函數(shù)運(yùn)行hypercuts算法
	hyper(filters); 
	
#ifdef information_2
	t = time(NULL);
	area = localtime(&t);
	// printf("Local time is: %s", asctime(area));
#endif
	return 0;
}

//函數(shù)p_node()打印樹的結(jié)構(gòu)到文件node.txt中
//修改時間:3月3日
void  p_node(struct node *nodes,int level)
{
	struct node *cnodes;
	FILE * fp;
	int i=0,totalcuts=1;
	id_list *fs;
	
	if (!nodes)
		return ;
	if(nodes)
	{   
		fp=fopen("node.txt","a");
		totalcuts=1;
		fprintf(fp,"level:%d \n",level++);
		fprintf(fp,"filter count:%d \n",nodes->filter_count);
		if(nodes->rectangle)
			fprintf(fp,"rectangle:%u %u %u %u\n",nodes->rectangle->start[0],nodes->rectangle->end[0],nodes->rectangle->start[1],nodes->rectangle->end[1]);
		for(i=0;i<2;i++)
		{
			fprintf(fp,"region:%u %u %u\n",nodes->start[i],nodes->end[i],nodes->cut[i]);
			totalcuts=totalcuts*nodes->cut[i];
		}
		for(fs=nodes->filters;fs;fs=fs->next)
			fprintf(fp,"%d\t",fs->id);
		fprintf(fp,"totalcuts:%d\n",totalcuts);
		fclose(fp);
		cnodes=nodes;
		for(i=0;i<totalcuts;i++)
		{   
			nodes=cnodes->branch[i];
			p_node(nodes,level);
		}
	}
	
}

//函數(shù)sapce_node()打印樹的結(jié)構(gòu)到文件node.txt中
//修改時間:3月3日
void space_node(struct node *nodes,long int &space)
{
	struct node *cnodes;
	int i=0,totalcuts=1;
	struct id_list *list,*L;
	struct filter *fs,*F;
	int count_l=0,count_f=0;
	if (!nodes)
	 	return;
	else 
	{   
		space=space+sizeof(node);
		totalcuts=1;
	
		count_l=0;
		count_f=0;
		for(list=nodes->filters;list;)
		{  
			count_l++;
			for(fs=list->filters;fs;)
			{
			count_f++;	F=fs;fs=fs->next;
			//free(F);
			}
			L=list;
			list=list->next;
		//	free(L); 
		}
		space=space+sizeof(id_list)*count_l+sizeof(filter)*count_f;
		if(nodes->rectangle)
		space=space+sizeof(hyper_rectangle);
		for(i=0;i<DIMENSIONS;i++)
		{
			totalcuts=totalcuts*nodes->cut[i];
		}
		cnodes=nodes;
		if(nodes->branch)
		{for(i=0;i<totalcuts&&totalcuts!=1;i++)
		{   
			if(nodes=cnodes->branch[i])
			space_node(nodes,space);
			else{ space=space+sizeof(node *); }
		}}
	//	free(nodes->branch);
	//	free(nodes);
	}
	
}

//返回?cái)?shù)據(jù)包中數(shù)據(jù)包頭的個數(shù)
int count_f(const char *filename)
{	
	char ch ;
    FILE *fp;
	int count=0;	
	
	fp=fopen(filename, "r");
	if (!fp) 
	{
		printf("filename error!\n");
		return 0;
	}
	
	ch='\0';
	
	//讀取文件,直到讀到文件末尾,文件類型是文本文件
	while (ch!=EOF)
	{   
		ch=fgetc(fp);
		if(ch=='\n') count++;//buffer讀取到下一條規(guī)則的開始處@,buffer最后一位賦值'0'	
	}
	fclose (fp);
//	printf("%d\n",count);
	return count;	
}
// The function repeatedly divide the filters into different groups according to different criterion.
void hyper(filter *filters) {
	UINT i;
	node *root, *tree_construction(id_list *, hyper_rectangle, UINT);
	//   filter *current;
	UINT filter_count(filter *), original=filter_count(filters);
	id_list *filter_lists=NULL, *add_id_list(id_list *head, filter *filters);
	
	clock_t first,second,third,forth; 
	double duration1=0,duration2=0; 
	
	first = clock(); 
	//add_id_list()函數(shù)的作用是將新規(guī)則filters對一個新的類型是id_list的內(nèi)存進(jìn)行賦值,然后加入到head的末尾
	for (filter *head=filters; head!=NULL; head=head->next)
		filter_lists=add_id_list(filter_lists, head);
	
	UINT id_list_count(id_list *);
	
	//為了計(jì)算初始化的時間,將這句輸出語句隱去
	//修改時間:08.2.28
	//	printf("id list count: %d", id_list_count(filter_lists));
	//初始化
	hyper_rectangle rectangle;
	for (i=0; i<DIMENSIONS; i++) {
		rectangle.start[i]=0;
		rectangle.end[i]=0xffffffff;
	}
	root=tree_construction(filter_lists, rectangle, 1);
	//本函數(shù)運(yùn)行在此之前為建樹過程
	second = clock(); 
	duration1 = (double)(second-first); 
	int level=0;
	#ifdef DEBUG 
	p_node(root,level);
	#endif
    //空間是怎么計(jì)算?
	//	printf("Node count: %d, branch count: %d, filter count: %d (Storage: %d Kbytes)\n", node_count, branch_count, filters_count, (node_count*32+branch_count*4+filters_count*16)/1024);
	//函數(shù)space_node()返回樹的空間,以byte計(jì)算
	
	//	UINT decision_tree_depth(node *, UINT);
	//   printf(", depth: %d", decision_tree_depth(root, 1));

	/******************************************************************************/
	/* Read the trace file generated by trace_generator.*/
	void trace_evaluation(header *, UINT, node *);
	//  struct stat statbuf;
	FILE *fd;
    int count_head=count_f(trace_file);
//	printf("%d\n",count_head);
	fd=fopen(trace_file, "rt");
	//先計(jì)算下有多少數(shù)據(jù)包,再分 配空間
     
	header *trace=NULL;
	if(count_head) trace=(header *)calloc(count_head, sizeof(header));
	i=0;
	UINT temp;
	while (fscanf(fd, "%d %d %d %d %d %d %d", &trace[i].value[0], &trace[i].value[1], &trace[i].value[2],
		&trace[i].value[3], &trace[i].value[4], &trace[i].value[5], &temp) != EOF)
		i++;
	

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品天干天干在观线| 欧美一区二区精品在线| 天天操天天综合网| 欧美国产日韩在线观看| 在线成人av影院| caoporm超碰国产精品| 免费观看久久久4p| 亚洲欧美一区二区三区久本道91| 日韩欧美中文字幕精品| 97se亚洲国产综合自在线不卡| 免费人成网站在线观看欧美高清| 亚洲婷婷在线视频| 久久先锋资源网| 6080午夜不卡| 色综合天天综合色综合av| 国产精品一区二区你懂的| 水蜜桃久久夜色精品一区的特点| 日韩美女精品在线| 久久久久久久久伊人| 日韩限制级电影在线观看| 91官网在线观看| 成人av网站在线观看免费| 国产精品一区二区果冻传媒| 日韩精品一二区| 亚洲第一狼人社区| 亚洲欧美另类久久久精品2019| 精品国产乱码久久久久久影片| 欧美久久久久久蜜桃| 在线观看日韩电影| 色又黄又爽网站www久久| 福利电影一区二区| 国产一区二区不卡在线| 免费成人美女在线观看.| 亚洲成人动漫在线观看| 亚洲午夜电影网| 亚洲宅男天堂在线观看无病毒| 亚洲伦在线观看| 综合婷婷亚洲小说| 亚洲欧洲综合另类| 亚洲影院理伦片| 亚洲国产日韩在线一区模特| 亚洲综合区在线| 亚洲亚洲人成综合网络| 一区二区成人在线| 亚洲成a人片在线观看中文| 亚洲国产成人高清精品| 午夜影院久久久| 日韩黄色在线观看| 老司机免费视频一区二区| 久久国产剧场电影| 国产在线视视频有精品| 国产高清不卡二三区| 国产激情视频一区二区三区欧美 | 国产不卡免费视频| 激情小说欧美图片| 久久精品国产成人一区二区三区| 免费观看日韩av| 九色|91porny| 久久精品国产一区二区| 蜜桃av噜噜一区| 极品美女销魂一区二区三区免费| 精品一区二区三区蜜桃| 九九热在线视频观看这里只有精品| 日韩精品电影在线| 婷婷六月综合网| 日本不卡123| 国产一区二区三区综合| 国产成人av一区二区三区在线| 国产美女娇喘av呻吟久久| 国产精品99久久久久| 国产黄人亚洲片| 国产精品一区二区x88av| 国产一区二区三区观看| 国产精品自拍毛片| av一区二区三区黑人| 在线视频你懂得一区二区三区| 欧美视频一区二区三区在线观看| 欧美亚洲国产一区二区三区| 欧美日韩一区二区三区高清| 91精品国产手机| 久久综合九色综合欧美亚洲| 中文av一区特黄| 一区二区三区四区不卡在线| 亚洲国产精品t66y| 亚洲女与黑人做爰| 视频一区在线视频| 国精产品一区一区三区mba桃花 | 蜜臀av性久久久久av蜜臀妖精| 久久国产福利国产秒拍| 国产福利精品导航| 99视频精品在线| 91精品国产综合久久精品性色| 精品久久久久久亚洲综合网 | 伊人一区二区三区| 日本美女一区二区三区视频| 国产一区免费电影| 在线观看欧美精品| 欧美日韩在线播放三区四区| 国产欧美一区二区精品性色超碰 | www.欧美色图| 精品美女在线播放| 一区二区三区自拍| 蜜桃在线一区二区三区| 成人动漫一区二区三区| 欧美日韩国产电影| 国产精品私人自拍| 日韩精品三区四区| 成人av在线观| 精品国产一区二区三区久久久蜜月| 日本一区免费视频| 一区二区日韩电影| 91香蕉国产在线观看软件| 欧美一区午夜视频在线观看| 亚洲欧洲日韩在线| 美女一区二区在线观看| 99精品一区二区三区| 欧美α欧美αv大片| 亚洲精品中文在线影院| 国产乱子伦一区二区三区国色天香 | 蜜桃一区二区三区在线| 一本一道久久a久久精品| 精品va天堂亚洲国产| 亚洲国产aⅴ天堂久久| 成人h精品动漫一区二区三区| 欧美高清一级片在线| 亚洲欧美激情视频在线观看一区二区三区| 日韩精品福利网| 福利电影一区二区| 国产日韩精品一区二区三区在线| 婷婷成人激情在线网| 日本道免费精品一区二区三区| 国产日韩欧美亚洲| 精品亚洲aⅴ乱码一区二区三区| 欧日韩精品视频| 最新热久久免费视频| 福利一区福利二区| 久久午夜免费电影| 紧缚奴在线一区二区三区| 欧美日韩精品欧美日韩精品一综合| 欧美极品aⅴ影院| 国内精品写真在线观看| 91精品婷婷国产综合久久性色 | 亚洲曰韩产成在线| 91一区在线观看| 国产精品不卡一区| 国产福利一区二区三区视频| 久久综合网色—综合色88| 免费人成在线不卡| 欧美mv和日韩mv的网站| 青草国产精品久久久久久| 欧美自拍偷拍午夜视频| 依依成人综合视频| 99riav久久精品riav| 国产精品久久久久久久久久久免费看| 国产很黄免费观看久久| 国产欧美一区二区精品久导航| 美女网站色91| 欧美久久一区二区| 久久精品国产77777蜜臀| 日韩精品一区二区三区中文精品| 免费在线观看一区| 欧美成人精品高清在线播放| 久久激情综合网| 国产视频在线观看一区二区三区| 国产九色sp调教91| 欧美国产日产图区| zzijzzij亚洲日本少妇熟睡| 国产午夜精品久久久久久免费视| 成人国产精品免费观看动漫| 日韩美女精品在线| 欧美性淫爽ww久久久久无| 午夜久久久久久电影| 日韩欧美综合在线| 国产不卡在线播放| 亚洲欧美色图小说| 欧美日韩成人一区二区| 免费在线观看一区二区三区| 欧美三级日韩在线| 国产一区三区三区| 亚洲人成电影网站色mp4| 欧美体内she精视频| 青娱乐精品视频| 欧美系列一区二区| 欧美一级黄色录像| 欧美伦理影视网| 国产成人丝袜美腿| 亚洲视频在线一区二区| 欧美视频在线不卡| 国产精品久久久久7777按摩| www.亚洲免费av| 欧美视频一二三区| 制服.丝袜.亚洲.中文.综合| 亚洲欧美综合色| 久久99国产精品成人| 在线观看91精品国产入口| 国产婷婷一区二区| 国内偷窥港台综合视频在线播放| 9色porny自拍视频一区二区| 在线一区二区视频| 日韩美女久久久|