p.print("
    public static void generateFusionHeader() {	int threadCount = NodeEnumerator.getNumberOfNodes();		TabbedPrintWriter p;	StringWriter str; 		str = new StringWriter();        p = new TabbedPrintWriter(str);	p.print("#ifndef __FUSION_H\n");	p.print("#define __FUSION_H\n");	p.println();		p.print("#define pow2ceil(A) ((A<=256)?(256):(((A<=1024)?(1024):(((A<=4096)?(4096):(((A<=16384)?(16384):(((A<=65536)?(65536):(((A<=131072)?(131072):(((A<=262144)?(262144):(524288))))))))))))))\n");	p.println();	//p.print("#define __ITERS 10000\n");	int mult = bestMult(16000,65000); // estimating best multiplicity 	p.print("#define __MULT "+mult+"\n");	p.println();	//p.print("/*\n");	for (int t = 0; t < threadCount; t++) {	    	    SIROperator oper = NodeEnumerator.getOperator(t);	    Vector out = RegisterStreams.getNodeOutStreams(oper);	    for (int i = 0; i < out.size(); i++) {		NetStream stream = (NetStream)out.elementAt(i);		int src = stream.getSource();		int dst = stream.getDest();		p.print("#define __FUSED_"+src+"_"+dst+"\n");		SIROperator src_oper = NodeEnumerator.getOperator(src);		SIROperator dst_oper = NodeEnumerator.getOperator(dst);		boolean no_peek = false;		if (dst_oper instanceof SIRJoiner ||		    dst_oper instanceof SIRSplitter) { no_peek = true; }				if (dst_oper instanceof SIRFilter) {		    SIRFilter f = (SIRFilter)dst_oper;		    if (f.getPeekInt() == f.getPopInt()) { no_peek = true; }		}		if (no_peek) p.print("#define __NOPEEK_"+src+"_"+dst+"\n");		int source_size = 0, dest_size = 0, max_size;				if (src_oper instanceof SIRJoiner) {		    SIRJoiner j = (SIRJoiner)src_oper;		    Integer steady = (Integer)ClusterBackend.steadyExecutionCounts.get(NodeEnumerator.getFlatNode(src));		    int steady_int = 0;		    if (steady != null) { steady_int = (steady).intValue(); }		    int push_n = j.getSumOfWeights();		    int total = (steady_int * push_n);		    p.print("//source pushes: "+steady_int+" * "+push_n+" = ("+total+" items)\n");		    source_size = total;		}		if (src_oper instanceof SIRFilter) {		    SIRFilter f = (SIRFilter)src_oper;		    Integer steady = (Integer)ClusterBackend.steadyExecutionCounts.get(NodeEnumerator.getFlatNode(src));		    int steady_int = 0;		    if (steady != null) { steady_int = (steady).intValue(); }		    int push_n = f.getPushInt();		    int total = (steady_int * push_n);		    p.print("//source pushes: "+steady_int+" * "+push_n+" = ("+total+" items)\n");		    source_size = total;		}		if (dst_oper instanceof SIRFilter) {		    SIRFilter f = (SIRFilter)dst_oper;		    Integer steady = (Integer)ClusterBackend.steadyExecutionCounts.get(NodeEnumerator.getFlatNode(dst));		    int steady_int = 0;		    if (steady != null) { steady_int = (steady).intValue(); }		    int pop_n = f.getPopInt();		    int peek_n = f.getPeekInt();		    p.print("//destination pops: "+steady_int+" * "+pop_n+" ");		    		    if (peek_n > pop_n) {			p.print("peeks: "+(peek_n-pop_n)+" ");		    		    }		    int total = (steady_int * pop_n) + (peek_n - pop_n);		    p.print(" = ("+total+" items)\n");		    dest_size = total;		}		if (dst_oper instanceof SIRSplitter) {		    SIRSplitter s = (SIRSplitter)dst_oper;		    Integer steady = (Integer)ClusterBackend.steadyExecutionCounts.get(NodeEnumerator.getFlatNode(dst));		    int steady_int = 0;		    if (steady != null) { steady_int = (steady).intValue(); }		    int pop_n = s.getSumOfWeights();		    if (s.getType().isDuplicate()) pop_n = 1;		    p.print("//destination pops: "+steady_int+" * "+pop_n+" ");		    		    int total = (steady_int * pop_n);		    p.print(" = ("+total+" items)\n");		    dest_size = total;		}		if (source_size > dest_size) max_size = source_size; else max_size = dest_size;		p.print("#define __BUF_SIZE_MASK_"+src+"_"+dst+" (pow2ceil("+max_size+"*__MULT)-1)\n");		p.print("\n");	    }	}	//p.print(" */\n");	p.print("#endif\n");	try {	    FileWriter fw = new FileWriter("fusion.h");	    fw.write(str.toString());	    fw.close();	}	catch (Exception e) {	    System.err.println("Unable to write fusion.h");	}    }