Index: /proiecte/PDAD/trunk/comptype/Makefile
===================================================================
--- /proiecte/PDAD/trunk/comptype/Makefile	(revision 154)
+++ /proiecte/PDAD/trunk/comptype/Makefile	(revision 154)
@@ -0,0 +1,23 @@
+SRC=./src/ro/pub/cs/pp/pdad/ComponentType.java
+JAR=comptype.jar
+CLASSPATH=../hadoop-0.20.1-core.jar
+HADOOP=/usr/local/hadoop/bin/hadoop
+BIN=bin
+INPUT=/user/hadoop/input/$(APP)/event_trace/event_trace.tab
+OUTPUT=/user/hadoop/output/comptype/$(APP)
+
+build: $(JAR)
+
+$(JAR): $(SRC)
+	@mkdir $(BIN)
+	@javac -cp $(CLASSPATH) -d ./$(BIN) $(SRC)
+	@jar -cvf $(JAR) -C ./$(BIN) .
+
+run: $(JAR)
+	@$(HADOOP) fs -rmr $(OUTPUT)
+	@$(HADOOP) jar ./$(JAR) ro.pub.cs.pp.pdad.ComponentType $(INPUT) $(OUTPUT)
+
+clean: 
+	rm -rf ./$(BIN)
+	rm -f ./$(JAR)
+	rm -f ./*~
Index: /proiecte/PDAD/trunk/comptype/pig/comptype.pig
===================================================================
--- /proiecte/PDAD/trunk/comptype/pig/comptype.pig	(revision 154)
+++ /proiecte/PDAD/trunk/comptype/pig/comptype.pig	(revision 154)
@@ -0,0 +1,7 @@
+
+A = load 'event_trace.tab' as (a, b, c, d, e, f, g, h, end_reason: int); 
+B = filter A by end_reason is not null; 
+C = group B by end_reason;
+D = foreach C generate group, COUNT($1);
+E = order D by $1; 
+dump E; 
Index: /proiecte/PDAD/trunk/comptype/src/ro/pub/cs/pp/pdad/ComponentType.java
===================================================================
--- /proiecte/PDAD/trunk/comptype/src/ro/pub/cs/pp/pdad/ComponentType.java	(revision 154)
+++ /proiecte/PDAD/trunk/comptype/src/ro/pub/cs/pp/pdad/ComponentType.java	(revision 154)
@@ -0,0 +1,69 @@
+package ro.pub.cs.pp.pdad;
+
+import java.io.IOException;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.mapreduce.Job; 
+import org.apache.hadoop.mapreduce.Mapper;
+import org.apache.hadoop.mapreduce.Reducer;
+import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
+import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
+
+public class ComponentType {
+
+	public static class Map extends Mapper<Object, Text, IntWritable, IntWritable> {
+		
+		private final static IntWritable one = new IntWritable(1); 
+		private final static IntWritable zero = new IntWritable(0); 
+		
+		private int extractComponentType(String line) {
+			String[] pieces = line.split("\\s+"); 
+			return Integer.parseInt(pieces[6]); 
+		}
+		
+		public void map(Object key, Text value, Context context) throws IOException, InterruptedException {
+			String line = value.toString(); 
+			try { 
+				int componentType = extractComponentType(line);
+				context.write(new IntWritable(componentType), one);
+			} catch (NumberFormatException ex) {
+				context.write(zero, zero); 
+			}
+			
+		}
+	}
+	
+	public static class Reduce extends Reducer <IntWritable, IntWritable, Text, IntWritable> {
+		
+		public static String[] compTypeMap = {"host", "CPU", "IO", "network", "memory", "software"}; 
+		private Text compType = new Text(); 
+		
+		public void reduce(IntWritable key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException {
+			int sum = 0; 
+			for (IntWritable cnt : values) {
+				sum += cnt.get(); 
+			}
+			compType.set(compTypeMap[key.get()]); 
+			context.write(compType, new IntWritable(sum));  
+		}
+	}
+	
+	public static void main(String[] args) throws Exception {
+		Configuration conf = new Configuration(); 
+		Job job = new Job(conf, "ComponentType");
+		job.setNumReduceTasks(5);
+		job.setJarByClass(ComponentType.class); 
+		job.setOutputKeyClass(IntWritable.class); 
+		job.setOutputValueClass(IntWritable.class); 
+		job.setMapperClass(Map.class);
+		/* don't set any combiner class */
+		job.setReducerClass(Reduce.class); 		
+		FileInputFormat.addInputPath(job, new Path(args[0])); 
+		FileOutputFormat.setOutputPath(job, new Path(args[1])); 
+		System.exit(job.waitForCompletion(true) ? 0 : 1);
+	}
+	
+}
Index: /proiecte/PDAD/trunk/copy.sh
===================================================================
--- /proiecte/PDAD/trunk/copy.sh	(revision 154)
+++ /proiecte/PDAD/trunk/copy.sh	(revision 154)
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+#LANL
+$HADOOP_HOME/bin/hadoop fs -put $PP_TESTS_DIR/lanl05_tab_union/event_trace.tab input/lanl05_tab_union/event_trace/event_trace.tab
+$HADOOP_HOME/bin/hadoop fs -put $PP_TESTS_DIR/lanl05_tab_union/node.tab input/lanl05_tab_union/node/node.tab
+$HADOOP_HOME/bin/hadoop fs -put $PP_TESTS_DIR/lanl05_tab_union/component.tab input/lanl05_tab_union/component/component.tab
+
+#Grid'5000
+$HADOOP_HOME/bin/hadoop fs -put $PP_TESTS_DIR/g5k06_tab/event_trace.tab input/g5k06_tab/event_trace/event_trace.tab
+$HADOOP_HOME/bin/hadoop fs -put $PP_TESTS_DIR/g5k06_tab/node.tab input/g5k06_tab/node/node.tab
+$HADOOP_HOME/bin/hadoop fs -put $PP_TESTS_DIR/g5k06_tab/component.tab input/g5k06_tab/component/component.tab
+
+#Microsoft
+$HADOOP_HOME/bin/hadoop fs -put $PP_TESTS_DIR/microsoft99_tab/event_trace.tab input/microsoft99_tab/event_trace/event_trace.tab
+$HADOOP_HOME/bin/hadoop fs -put $PP_TESTS_DIR/microsoft99_tab/node.tab input/microsoft99_tab/node/node.tab
+$HADOOP_HOME/bin/hadoop fs -put $PP_TESTS_DIR/microsoft99_tab/component.tab input/microsoft99_tab/component/component.tab
+
+#SETI@home
+$HADOOP_HOME/bin/hadoop fs -put $PP_TESTS_DIR/seti_5min_tab/event_trace.tab input/seti09_tab/event_trace/event_trace.tab
+$HADOOP_HOME/bin/hadoop fs -put $PP_TESTS_DIR/seti_5min_tab/node.tab input/seti09_tab/node/node.tab
+$HADOOP_HOME/bin/hadoop fs -put $PP_TESTS_DIR/seti_5min_tab/component.tab input/seti09_tab/component/component.tab
Index: /proiecte/PDAD/trunk/endreason/Makefile
===================================================================
--- /proiecte/PDAD/trunk/endreason/Makefile	(revision 154)
+++ /proiecte/PDAD/trunk/endreason/Makefile	(revision 154)
@@ -0,0 +1,23 @@
+SRC=./src/ro/pub/cs/pp/pdad/EndReason.java
+JAR=endreason.jar
+CLASSPATH=../hadoop-0.20.1-core.jar
+HADOOP=/usr/local/hadoop/bin/hadoop
+BIN=bin
+INPUT=/user/hadoop/input/$(APP)/event_trace/event_trace.tab
+OUTPUT=/user/hadoop/output/endreason/$(APP)
+
+build: $(JAR)
+
+$(JAR): $(SRC)
+	@mkdir $(BIN)
+	@javac -cp $(CLASSPATH) -d ./$(BIN) $(SRC)
+	@jar -cvf $(JAR) -C ./$(BIN) .
+
+run: $(JAR)
+	@$(HADOOP) fs -rmr $(OUTPUT)
+	@$(HADOOP) jar ./$(JAR) ro.pub.cs.pp.pdad.EndReason $(INPUT) $(OUTPUT)
+
+clean: 
+	rm -rf ./$(BIN)
+	rm -f ./$(JAR)
+	rm -f ./*~
Index: /proiecte/PDAD/trunk/endreason/pig/endreason.pig
===================================================================
--- /proiecte/PDAD/trunk/endreason/pig/endreason.pig	(revision 154)
+++ /proiecte/PDAD/trunk/endreason/pig/endreason.pig	(revision 154)
@@ -0,0 +1,7 @@
+
+A = load '$inputDir/event_trace.tab' as (a, b, c, d, e, f, g, h, end_reason: int); 
+B = filter A by end_reason is not null; 
+C = group B by end_reason;
+D = foreach C generate group, COUNT($1);
+E = order D by $1; 
+STORE E INTO '$outputDir' USING PigStorage(); 
Index: /proiecte/PDAD/trunk/endreason/pig/run.sh
===================================================================
--- /proiecte/PDAD/trunk/endreason/pig/run.sh	(revision 154)
+++ /proiecte/PDAD/trunk/endreason/pig/run.sh	(revision 154)
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+$HADOOP_HOME/bin/hadoop fs -rmr output/endreason/pig/$1
+java -cp $PIG_CLASSPATH org.apache.pig.Main -param inputDir=/user/hadoop/input/$1/event_trace -param outputDir=output/endreason/pig/$1 endreason.pig
+$HADOOP_HOME/bin/hadoop fs -cat output/endreason/pig/$1/part-00000
Index: /proiecte/PDAD/trunk/endreason/src/ro/pub/cs/pp/pdad/EndReason.java
===================================================================
--- /proiecte/PDAD/trunk/endreason/src/ro/pub/cs/pp/pdad/EndReason.java	(revision 154)
+++ /proiecte/PDAD/trunk/endreason/src/ro/pub/cs/pp/pdad/EndReason.java	(revision 154)
@@ -0,0 +1,99 @@
+package ro.pub.cs.pp.pdad;
+
+import java.io.IOException;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.mapreduce.Job; 
+import org.apache.hadoop.mapreduce.Mapper;
+import org.apache.hadoop.mapreduce.Reducer;
+import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
+import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
+
+public class EndReason {
+
+	private static int[] domains = {-1, 0, 1, 1000, 2000, 3000, 4000, 5000, 6000, 7000};
+	private static String[] reasonName = {"not reported", "undetermined", "infrastructure", "hardware", "IO", "network", "software", "human error", "user"}; 
+	
+	public static class Map extends Mapper<Object, Text, IntWritable, IntWritable> {
+		
+		private static String null_reason = "NULL"; 
+		
+		private final static IntWritable one = new IntWritable(1); 
+		private final static IntWritable zero = new IntWritable(0); 
+		private final static int fieldNo = 9; 
+		
+		private int findDomainCode(int reasonCode) {
+			for (int domainCode = 0; domainCode < domains.length - 1; domainCode++) {
+				if (domains[domainCode] <= reasonCode && reasonCode < domains[domainCode + 1])
+					return domainCode; 
+			}
+			return 0; 
+		}
+		
+		private int extractReasonDomainCode(String line) {
+			String[] pieces = line.split("\\s+");
+			if (pieces.length < fieldNo + 1) {
+				return 0; 
+			}
+			String reason = pieces[fieldNo]; 
+			if (reason.equals(null_reason)) {
+				return 0; 				
+			} else {
+				int reasonCode = Integer.parseInt(reason);
+				return findDomainCode(reasonCode); 
+			}
+		}
+		
+		public void map(Object key, Text value, Context context) throws IOException, InterruptedException {
+			String line = value.toString(); 
+			try { 
+				int reasonDomain = extractReasonDomainCode(line);
+				context.write(new IntWritable(reasonDomain), one);
+			} catch (NumberFormatException ex) {
+				context.write(zero, zero); 
+			}
+			
+		}
+	}
+	
+	public static class Reduce extends Reducer <IntWritable, IntWritable, Text, IntWritable> {
+		
+		private Text reasonDomain = new Text(); 
+		
+		public void reduce(IntWritable key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException {
+			int sum = 0; 
+			for (IntWritable cnt : values) {
+				sum += cnt.get(); 
+			}
+			reasonDomain.set(reasonName[key.get()]); 
+			context.write(reasonDomain, new IntWritable(sum));  
+		}
+	}
+	
+	public static void main(String[] args) throws Exception {
+		Configuration conf = new Configuration(); 
+		Job job = new Job(conf, "EndReason"); 
+		job.setNumReduceTasks(5);
+		job.setJarByClass(EndReason.class);
+		
+		/* set map output key/value classes */
+		job.setMapOutputKeyClass(IntWritable.class); 
+		job.setMapOutputValueClass(IntWritable.class); 
+		
+		/* set application output key/value classes */
+		job.setOutputKeyClass(Text.class); 
+		job.setOutputValueClass(IntWritable.class);
+		
+		job.setMapperClass(Map.class);
+		job.setReducerClass(Reduce.class); 		
+		/* don't set any combiner class */
+		
+		FileInputFormat.addInputPath(job, new Path(args[0])); 
+		FileOutputFormat.setOutputPath(job, new Path(args[1])); 
+		System.exit(job.waitForCompletion(true) ? 0 : 1);
+	}
+	
+}
Index: /proiecte/PDAD/trunk/endreasonstat/Makefile
===================================================================
--- /proiecte/PDAD/trunk/endreasonstat/Makefile	(revision 154)
+++ /proiecte/PDAD/trunk/endreasonstat/Makefile	(revision 154)
@@ -0,0 +1,24 @@
+SRC=./src/ro/pub/cs/pp/pdad/EndReasonStat.java
+JAR=endreasonstat.jar
+CLASSPATH=../hadoop-0.20.1-core.jar
+HADOOP=/usr/local/hadoop/bin/hadoop
+BIN=bin
+INPUT=/user/hadoop/input/$(APP)/event_trace/event_trace.tab
+OUTPUT=/user/hadoop/output/endreasonstat/$(APP)
+
+build: $(JAR)
+
+$(JAR): $(SRC)
+	@mkdir $(BIN)
+	@javac -cp $(CLASSPATH) -d ./$(BIN) $(SRC)
+	@jar -cvf $(JAR) -C ./$(BIN) .
+
+run: $(JAR)
+	@$(HADOOP) fs -rmr $(OUTPUT)
+	@$(HADOOP) jar ./$(JAR) ro.pub.cs.pp.pdad.EndReasonStat $(INPUT) $(OUTPUT)
+
+clean: 
+	rm -rf ./$(BIN)
+	rm -f ./$(JAR)
+	rm -f ./*~
+
Index: /proiecte/PDAD/trunk/endreasonstat/src/ro/pub/cs/pp/pdad/EndReasonStat.java
===================================================================
--- /proiecte/PDAD/trunk/endreasonstat/src/ro/pub/cs/pp/pdad/EndReasonStat.java	(revision 154)
+++ /proiecte/PDAD/trunk/endreasonstat/src/ro/pub/cs/pp/pdad/EndReasonStat.java	(revision 154)
@@ -0,0 +1,203 @@
+package ro.pub.cs.pp.pdad;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.HashMap;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.WritableComparable;
+import org.apache.hadoop.io.WritableComparator;
+import org.apache.hadoop.mapreduce.Job; 
+import org.apache.hadoop.mapreduce.Mapper;
+import org.apache.hadoop.mapreduce.Reducer;
+import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
+import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
+
+public class EndReasonStat {
+
+	private static int[] domains = {-1, 0, 1, 1000, 2000, 3000, 4000, 5000, 6000, 7000};
+	private static String[] reasonName = {"not reported", "undetermined", "infrastructure", "hardware", "IO", "network", "software", "human error", "user"}; 
+	
+	public static class IntPair implements WritableComparable<IntPair> {
+		private int first = 0;
+		private int second = 0;
+
+		/**
+		 * Set the left and right values.
+		 */
+		public void set(int left, int right) {
+			first = left;
+			second = right;
+		}
+
+		public int getFirst() {
+			return first;
+		}
+
+		public int getSecond() {
+			return second;
+		}
+
+		/**
+		 * Read the two integers. Encoded as: MIN_VALUE -> 0, 0 -> -MIN_VALUE,
+		 * MAX_VALUE-> -1
+		 */
+		@Override
+		public void readFields(DataInput in) throws IOException {
+			first = in.readInt() + Integer.MIN_VALUE;
+			second = in.readInt() + Integer.MIN_VALUE;
+		}
+
+		@Override
+		public void write(DataOutput out) throws IOException {
+			out.writeInt(first - Integer.MIN_VALUE);
+			out.writeInt(second - Integer.MIN_VALUE);
+		}
+
+		@Override
+		public int hashCode() {
+			return first * 157 + second;
+		}
+
+		@Override
+		public boolean equals(Object right) {
+			if (right instanceof IntPair) {
+				IntPair r = (IntPair) right;
+				return r.first == first && r.second == second;
+			} else {
+				return false;
+			}
+		}
+
+		/** A Comparator that compares serialized IntPair. */
+		public static class Comparator extends WritableComparator {
+			public Comparator() {
+				super(IntPair.class);
+			}
+
+			public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2,
+					int l2) {
+				return compareBytes(b1, s1, l1, b2, s2, l2);
+			}
+		}
+
+		static { // register this comparator
+			WritableComparator.define(IntPair.class, new Comparator());
+		}
+
+		@Override
+		public int compareTo(IntPair o) {
+			if (first != o.first) {
+				return first < o.first ? -1 : 1;
+			} else if (second != o.second) {
+				return second < o.second ? -1 : 1;
+			} else {
+				return 0;
+			}
+		}
+	}
+
+	  public static class Map extends Mapper<Object, Text, IntWritable, IntPair> {
+		
+		private static String null_reason = "NULL"; 
+		
+		private final static IntPair onePair = new IntPair(); 
+		private final static IntWritable zero = new IntWritable(0); 
+		private final static int fieldNo = 9; 
+		
+		private int findDomainCode(int reasonCode) {
+			for (int domainCode = 0; domainCode < domains.length - 1; domainCode++) {
+				if (domains[domainCode] <= reasonCode && reasonCode < domains[domainCode + 1])
+					return domainCode; 
+			}
+			return 0; 
+		}
+		
+		private int extractReasonCode(String line) {
+			String[] pieces = line.split("\\s+");
+			if (pieces.length < fieldNo + 1) {
+				return 0; 
+			}
+			String reason = pieces[fieldNo];
+			
+			if (reason.equals(null_reason)) {
+				return 0; 				
+			} else {
+				int reasonCode = Integer.parseInt(reason);
+				return reasonCode; 
+			}
+		}
+		
+		public void map(Object key, Text value, Context context) throws IOException, InterruptedException {
+			String line = value.toString(); 
+			try { 
+				int reasonCode = extractReasonCode(line);
+				int reasonDomainCode = findDomainCode(reasonCode); 
+				onePair.set(reasonCode, 1); 
+				context.write(new IntWritable(reasonDomainCode), onePair);
+			} catch (NumberFormatException ex) {
+				onePair.set(0, 0);
+				context.write(zero, onePair); 
+			}
+			
+		}
+	}
+	
+	
+	public static class Reduce extends Reducer <IntWritable, IntPair, Text, IntWritable> {
+		
+		private Text reason = new Text(); 
+		
+		public void reduce(IntWritable key, Iterable<IntPair> values, Context context) throws IOException, InterruptedException {
+			/* write the domain name */
+			reason.set(reasonName[key.get()]); 
+			context.write(reason, null);
+			
+			HashMap<Integer, Integer> reasonSum = new HashMap<Integer, Integer>();
+			for (IntPair pair : values) {
+				int reasonCode = pair.getFirst();
+				if (reasonSum.containsKey(reasonCode)) {
+					int newSum = reasonSum.get(reasonCode) + pair.getSecond(); 
+					reasonSum.put(reasonCode, newSum); 
+				} else {
+					reasonSum.put(reasonCode, pair.getSecond()); 
+				}
+			}
+			
+			for (int reasonCode : reasonSum.keySet()) {
+				reason.set(new String("\t" +reasonCode));
+				context.write(reason, new IntWritable(reasonSum.get(reasonCode))); 
+			}
+		}
+	}
+	
+	public static void main(String[] args) throws Exception {
+		Configuration conf = new Configuration(); 
+		Job job = new Job(conf, "EndReasonStat"); 
+		job.setNumReduceTasks(5);
+		job.setJarByClass(EndReasonStat.class);
+		
+		/* set map output key/value classes */
+		job.setMapOutputKeyClass(IntWritable.class); 
+		job.setMapOutputValueClass(IntPair.class); 
+		
+		/* set application output key/value classes */
+		job.setOutputKeyClass(Text.class); 
+		job.setOutputValueClass(IntWritable.class);
+		
+		job.setMapperClass(Map.class);
+		job.setReducerClass(Reduce.class); 		
+		/* don't set any combiner class */
+		
+		FileInputFormat.addInputPath(job, new Path(args[0])); 
+		FileOutputFormat.setOutputPath(job, new Path(args[1])); 
+		
+		System.exit(job.waitForCompletion(true) ? 0 : 1);
+	}
+	
+}
+
Index: /proiecte/PDAD/trunk/failurecause/mapreduce/FailureCause.java
===================================================================
--- /proiecte/PDAD/trunk/failurecause/mapreduce/FailureCause.java	(revision 154)
+++ /proiecte/PDAD/trunk/failurecause/mapreduce/FailureCause.java	(revision 154)
@@ -0,0 +1,182 @@
+/**
+ * Frequent (>1000) failure cause for different categories of events grouped by duration (short, medium, long)
+ * 
+ * @author cristina
+ */
+
+package org.PP;
+
+import java.io.IOException;
+import java.util.*;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.conf.*;
+import org.apache.hadoop.io.*;
+import org.apache.hadoop.mapred.*;
+import org.apache.hadoop.util.*;
+
+public class FailureCause {
+
+	public static class Map extends MapReduceBase implements
+			Mapper<LongWritable, Text, Text, LongWritable> {
+
+		// Usage: a value that is greater than the previous key in a map but not
+		// greater than the current key is classified as the current value
+		public static HashMap<Integer, String> failureCause = new HashMap<Integer, String>();
+		public static HashMap<Integer, String> durationGroup = new HashMap<Integer, String>();
+
+		public static void init() {
+			// failure cause
+			failureCause.put(new Integer(-1), "not reported");
+			failureCause.put(new Integer(0), "reported as undetermined");
+			failureCause.put(new Integer(999), "infrastructure");
+			failureCause.put(new Integer(1999), "hardware");
+			failureCause.put(new Integer(2999), "IO");
+			failureCause.put(new Integer(3999), "network");
+			failureCause.put(new Integer(4999), "software");
+			failureCause.put(new Integer(5999), "human error");
+			failureCause.put(new Integer(6999), "user");
+			failureCause.put(new Integer(7000), "end of measurement");
+
+			// group by duration
+			durationGroup.put(new Integer(1000), "short");
+			durationGroup.put(new Integer(100000), "medium");
+			durationGroup.put(Integer.MAX_VALUE, "long");
+		}
+
+		public void map(LongWritable key, Text value,
+				OutputCollector<Text, LongWritable> output, Reporter reporter)
+				throws IOException {
+
+			Map.init();
+			
+			Text label = new Text();
+			String line = value.toString();
+
+			// skip comments
+			if (!line.startsWith("#")) {
+				Double start = new Double(0), end = new Double(0), duration = new Double(
+						0);
+				Integer fault = new Integer(0);
+				int count = 0;
+
+				// collons 7, 8 and 9 are start, end time of job, failure code
+				// respectively
+				StringTokenizer tokenizer = new StringTokenizer(line);
+				while (tokenizer.hasMoreTokens()) {
+					count++;
+					String token = tokenizer.nextToken();
+					if (count == 7)
+						start = Double.parseDouble(token);
+					if (count == 8)
+						end = Double.parseDouble(token);
+					if (count == 9) {
+						if (token.compareTo("NULL") == 0) {
+							fault = -1;
+						} else
+							fault = Integer.parseInt(token);
+					}
+				}
+
+				String durationClass = "", faultClass = "";
+
+				// get duration class
+				duration = end - start;
+				LinkedList<Integer> ll1 = new LinkedList<Integer>(
+						Map.durationGroup.keySet());
+				Collections.sort(ll1);
+				Iterator iterator1 = ll1.iterator();
+				while (iterator1.hasNext()) {
+					int mkey = (Integer) iterator1.next();
+					if (duration <= mkey) {
+						String mvalue = (String) Map.durationGroup.get(mkey);
+						durationClass = mvalue;
+						break;
+					}
+				}
+
+				// get fault class
+				LinkedList<Integer> ll2 = new LinkedList<Integer>(
+						Map.failureCause.keySet());
+				Collections.sort(ll2);
+				Iterator iterator2 = ll2.iterator();
+				while (iterator2.hasNext()) {
+					int mkey = (Integer) iterator2.next();
+					if (fault <= mkey) {
+						String mvalue = (String) Map.failureCause.get(mkey);
+						faultClass = mvalue;
+						break;
+					}
+				}
+
+				if(faultClass.compareTo("") == 0)
+					faultClass = "TYPING";
+				
+				label = new Text(durationClass + " event - " + faultClass
+						+ " fault");
+
+				// map
+				output.collect(label, new LongWritable(1));
+			}
+		}
+	}
+
+	public static class Combine extends MapReduceBase implements Reducer<Text, LongWritable, Text, LongWritable> {
+	
+	public void reduce(Text key, Iterator<LongWritable> values,
+			OutputCollector<Text, LongWritable> output, Reporter reporter)
+			throws IOException {
+	
+		Long sum = new Long(0);
+	
+		// sum them
+		while (values.hasNext()) {
+			sum += values.next().get();
+		}
+	
+		output.collect(key, new LongWritable(sum));
+	}
+}
+	
+	public static class Reduce extends MapReduceBase implements
+			Reducer<Text, LongWritable, Text, LongWritable> {
+
+		public void reduce(Text key, Iterator<LongWritable> values,
+				OutputCollector<Text, LongWritable> output, Reporter reporter)
+				throws IOException {
+
+			Long sum = new Long(0);
+
+			// sum them
+			while (values.hasNext()) {
+				sum += values.next().get();
+			}
+
+			if(sum > 1000)
+				output.collect(key, new LongWritable(sum));
+		}
+	}
+
+	public static void main(String[] args) throws Exception {
+		
+		JobConf conf = new JobConf(FailureCause.class);
+		conf.setJobName("failureCause");
+
+		conf.setOutputKeyClass(Text.class);
+		conf.setOutputValueClass(LongWritable.class);
+
+		conf.setMapperClass(Map.class);
+		conf.setCombinerClass(Combine.class);
+		conf.setReducerClass(Reduce.class);
+
+		conf.setInputFormat(TextInputFormat.class);
+		conf.setOutputFormat(TextOutputFormat.class);
+
+		FileInputFormat.setInputPaths(conf, new Path(args[0]));
+		FileOutputFormat.setOutputPath(conf, new Path(args[1]));
+
+		conf.setNumReduceTasks(5);
+
+		JobClient.runJob(conf);
+	}
+}
Index: /proiecte/PDAD/trunk/failurecause/mapreduce/jar.sh
===================================================================
--- /proiecte/PDAD/trunk/failurecause/mapreduce/jar.sh	(revision 154)
+++ /proiecte/PDAD/trunk/failurecause/mapreduce/jar.sh	(revision 154)
@@ -0,0 +1,7 @@
+# ar trebui facut intr-un script ant
+
+mkdir failure_classes
+javac -classpath $HADOOP_HOME/hadoop-0.20.1-core.jar -d failure_classes FailureCause.java
+jar -cvf failurecause.jar -C failure_classes/ .
+rm -r failure_classes
+
Index: /proiecte/PDAD/trunk/failurecause/mapreduce/run.sh
===================================================================
--- /proiecte/PDAD/trunk/failurecause/mapreduce/run.sh	(revision 154)
+++ /proiecte/PDAD/trunk/failurecause/mapreduce/run.sh	(revision 154)
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+
+$HADOOP_HOME/bin/hadoop fs -rmr output/failurecause/$1
+$HADOOP_HOME/bin/hadoop jar failurecause.jar org.PP.FailureCause /user/hadoop/input/$1/event_trace/event_trace.tab /user/hadoop/output/failurecause/$1
+echo "Result available in /user/hadoop/output/failurecause/$1: $HADOOP_HOME/bin/hadoop fs -cat /user/hadoop/output/failurecause/$1/part-00000"
+echo "-------------------------"
+echo "PRINTING..."
+echo "-------------------------"
+$HADOOP_HOME/bin/hadoop fs -cat /user/hadoop/output/failurecause/$1/part-00000
Index: /proiecte/PDAD/trunk/failurecause/mpi/Makefile
===================================================================
--- /proiecte/PDAD/trunk/failurecause/mpi/Makefile	(revision 154)
+++ /proiecte/PDAD/trunk/failurecause/mpi/Makefile	(revision 154)
@@ -0,0 +1,7 @@
+CC=mpicc
+CFLAGS=-g -Wall 
+
+all:
+	mpicc -o failureCause failureCause.c
+clean:
+	rm failurecause *~
Index: /proiecte/PDAD/trunk/failurecause/mpi/failureCause.c
===================================================================
--- /proiecte/PDAD/trunk/failurecause/mpi/failureCause.c	(revision 154)
+++ /proiecte/PDAD/trunk/failurecause/mpi/failureCause.c	(revision 154)
@@ -0,0 +1,251 @@
+// Frequent (>1000) failure cause for different categories of events grouped by duration (short, medium, long)
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "mpi.h"
+
+#define CHUNK 20480
+#define ENCODED_NO 33
+
+
+unsigned long* poz;
+unsigned long recv[2];
+unsigned long poz_size = 0;
+unsigned long recv_m[ENCODED_NO];
+unsigned long send_m[ENCODED_NO];
+
+int failure_key[] = {-1, 0, 999, 1999, 2999, 3999, 4999, 5999, 6999, 7000, 7001};
+char* failure_value[] = {"not reported", "reported as undetermined", "infrastructure", "hardware", "IO", "network", "software", "human error",
+		"user", "end of measurement", "TYPING"};
+long duration_key[] = {1000, 100000, 2147483647};
+char* duration_value[] = {"short", "medium", "long"};
+char* encoded_values[] = {"short-not reported", "medium-not reported", "long-not reported", "short-reported as undetermined",
+		"medium-reported as undetermined", "long-reported as undetermined", "short-infrastructure", "medium-infrastructure",
+		"long-infrastructure", "short-hardware", "medium-hardware", "long-hardware", "short-IO", "medium-IO", "long-IO", "short-network",
+		"medium-network", "long-network", "short-software", "medium-software", "long-software", "short-human error",
+		"medium-human error", "long-human error", "short-user", "medium-user", "long-user", "short-end of measurement",
+		"medium-end of measurement", "long-end of measurement", "short-TYPING", "medium-TYPING", "long-TYPING"};
+
+unsigned long file_length(FILE *f) {
+	long pos;
+	long end;
+
+	pos = ftell (f);
+	fseek (f, 0, SEEK_END);
+	end = ftell (f);
+	fseek (f, pos, SEEK_SET);
+
+	return end;
+}
+
+
+void write_result (char *filename) {
+	FILE *f;
+	int i;
+
+	f = fopen(filename, "wt");
+	if (f == NULL) {
+		fprintf(stderr, "Could not open file write.\n");
+		MPI_Abort(MPI_COMM_WORLD, 7777);
+	}
+
+	for(i = 0 ; i < ENCODED_NO ; i++) {
+		fprintf(f, "%-40s", encoded_values[i]);
+		fprintf(f, "%i\n", recv_m[i]);
+	}
+}
+
+int init(char *filename) {
+	unsigned long file_len = 0;
+	unsigned long i, j;
+	FILE *f;
+	size_t read = 0;
+
+	f = fopen(filename, "rt");
+	if (f == NULL) {
+		fprintf(stderr, "Could not open file init.\n");
+		MPI_Abort(MPI_COMM_WORLD, 7777);
+	}
+	file_len = file_length(f);
+	poz_size = file_len / CHUNK + 1;
+
+	poz = (unsigned long*) malloc(poz_size * sizeof(unsigned long));
+	poz[0] = 0;
+	for (i = CHUNK, j = 1; j < poz_size - 1; i += CHUNK, j++) {
+		poz[j] = i;
+	}
+	poz[j] = file_len;
+
+	return 1;
+}
+
+int main(int argc, char** argv) {
+
+	int rank, size;
+	MPI_Status status;
+	MPI_Request request;
+	int i, flag, j;
+
+	MPI_Init(&argc, &argv);
+	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+	MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+	if (rank == 0) {
+		// master inits
+		init(argv[1]);
+	}
+	MPI_Barrier(MPI_COMM_WORLD);
+
+	// master sends indexes, receives results
+	if(rank == 0) {
+
+		for(i = 0 ; i < ENCODED_NO ; i++) {
+			recv_m[i] = 0;
+			send_m[i] = 0;
+		}
+
+		// sends indexes
+		for (i = 0; i < poz_size - 1; i++) {
+			MPI_Isend(poz+i, 2, MPI_UNSIGNED_LONG, i%(size-1)+1, 0, MPI_COMM_WORLD, &request);
+		}
+
+		// receive results
+		unsigned long recv_temp[ENCODED_NO];
+		while(1) {
+
+			for(i = 0 ; i < ENCODED_NO ; i++)
+				recv_temp[i] = 0;
+			MPI_Irecv(recv_temp, ENCODED_NO, MPI_UNSIGNED_LONG, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, &request);
+
+			MPI_Test(&request, &flag, &status);
+			int times = 0;
+			while(!flag && times < 10) {
+				times++;
+				sleep(1);
+				MPI_Test(&request, &flag, &status);
+			}
+			if(!flag)
+				break;
+
+			for(i = 0 ; i < ENCODED_NO ; i++) {
+				recv_m[i] += recv_temp[i];
+			}
+		}
+
+		// write results
+		write_result(argv[2]);
+		free(poz);
+	}
+
+	// slaves receive indexes, do computation
+	else {
+		while(1) {
+
+			// receive until there's nothing left
+			MPI_Irecv(recv, 2, MPI_UNSIGNED_LONG, 0, 0, MPI_COMM_WORLD, &request);
+
+			MPI_Test(&request, &flag, &status);
+			int times = 0;
+			while(!flag && times < 10) {
+				times++;
+				sleep(1);
+				MPI_Test(&request, &flag, &status);
+			}
+			if(!flag)
+				break;
+
+			// read file and do computation
+			FILE *f;
+
+			f = fopen(argv[1], "rt");
+			if (f == NULL) {
+				fprintf(stderr, "Could not open file.\n");
+				MPI_Abort(MPI_COMM_WORLD, 7777);
+			}
+
+			fseek (f, recv[0], SEEK_SET);
+
+			// go to the end of the line
+			char * line = NULL;
+			size_t len = 0;
+			ssize_t read;
+			unsigned long count = 0;
+
+			for(i = 0 ; i < ENCODED_NO ; i++) {
+				send_m[i] = 0;
+				recv_m[i] = 0;
+			}
+
+			while ((read = getline(&line, &len, f)) != -1) {
+
+				// skip the comment line and the half lines
+				count++;
+				if(count == 1)
+					continue;
+
+				// compute
+				char response;
+
+				double start, end, duration;
+				int fault = -2;
+				char delims[] = " ";
+				char *result = NULL;
+				result = strtok( line, delims );
+				int token_no = 0;
+				while( result != NULL ) {
+					token_no++;
+					if(token_no == 7) {
+						start = atof(result);
+					}
+					if(token_no == 8) {
+						end = atof(result);
+					}
+					if(token_no == 9) {
+						if(strncmp(result, "NULL", 4) == 0)
+							fault = -1;
+						else
+							fault = atoi(result);
+					}
+				    result = strtok( NULL, delims );
+				}
+
+				int tag = 0;
+
+				if(fault > failure_key[10]) {
+					// detect typing fault
+					fault = 7001;
+				}
+				for(i = 0 ; i < 11 ; i++) {
+					if(fault <= failure_key[i]) {
+						tag = i * 3;
+						break;
+					}
+				}
+
+				duration = end - start;
+				for(i = 0 ; i < 3 ; i++) {
+					if(duration <= duration_key[i]) {
+						tag += i;
+						break;
+					}
+				}
+
+				send_m[tag]++;
+
+				// finished reading chunk?
+				if(ftell(f) > recv[1])
+					break;
+
+			  }
+
+			// send result to master
+			MPI_Isend(send_m, ENCODED_NO, MPI_UNSIGNED_LONG, 0, 0, MPI_COMM_WORLD, &request);
+		}
+	}
+
+	// block and finish
+	MPI_Barrier(MPI_COMM_WORLD);
+	MPI_Finalize();
+}
+
Index: /proiecte/PDAD/trunk/failurecause/mpi/readme
===================================================================
--- /proiecte/PDAD/trunk/failurecause/mpi/readme	(revision 154)
+++ /proiecte/PDAD/trunk/failurecause/mpi/readme	(revision 154)
@@ -0,0 +1,5 @@
+Run:
+mpiexec -n nr_procs ./failureCause path_to_event_trace.tab output_file
+
+e.g.
+mpiexec -n 2 ./failureCause $PP_TESTS_DIR/seti/event_trace.tab file output_seti
Index: /proiecte/PDAD/trunk/failurecause/pig/local/RealLabels.java
===================================================================
--- /proiecte/PDAD/trunk/failurecause/pig/local/RealLabels.java	(revision 154)
+++ /proiecte/PDAD/trunk/failurecause/pig/local/RealLabels.java	(revision 154)
@@ -0,0 +1,113 @@
+import java.io.IOException;
+import java.util.*;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataBag;
+import org.apache.pig.data.DefaultBagFactory;
+import org.apache.pig.data.DefaultTupleFactory;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.apache.pig.data.DataType;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+
+public class RealLabels extends EvalFunc<DataBag> {
+
+	public static HashMap<Double, String> failureCause = new HashMap<Double, String>();
+	public static HashMap<Double, String> durationGroup = new HashMap<Double, String>();
+	
+	public static void init() {
+		// failure cause
+		failureCause.put(new Double(-1), "not reported");
+		failureCause.put(new Double(0), "reported as undetermined");
+		failureCause.put(new Double(999), "infrastructure");
+		failureCause.put(new Double(1999), "hardware");
+		failureCause.put(new Double(2999), "IO");
+		failureCause.put(new Double(3999), "network");
+		failureCause.put(new Double(4999), "software");
+		failureCause.put(new Double(5999), "human error");
+		failureCause.put(new Double(6999), "user");
+		failureCause.put(new Double(7000), "end of measurement");
+
+		// group by duration
+		durationGroup.put(new Double(1000), "short");
+		durationGroup.put(new Double(100000), "medium");
+		durationGroup.put(Double.MAX_VALUE, "long");
+	}
+
+    @Override
+    public DataBag exec(Tuple input) throws IOException {
+    	RealLabels.init();
+
+	if (input == null || input.size() == 0)
+            return null;
+        try{
+
+        	Double duration = (Double)input.get(0);
+        	//System.out.println("duration="+duration);
+        	Double failure = new Double(0);
+        	if(duration != null && failure != null) {
+		
+				String f = new String(input.get(1).toString());
+				StringTokenizer st = new StringTokenizer(f);
+				String token = st.nextToken();
+				if(token.compareTo("NULL") == 0)
+					failure = -1.0;
+				else
+					failure = Double.parseDouble(token);
+				
+				//System.out.println("failure="+failure);
+				String durationClass = "", faultClass = "";
+		
+				// get duration class
+					LinkedList<Double> ll1 = new LinkedList<Double>(
+							RealLabels.durationGroup.keySet());
+					Collections.sort(ll1);
+					Iterator iterator1 = ll1.iterator();
+					while (iterator1.hasNext()) {
+						double mkey = (Double) iterator1.next();
+						if (duration <= mkey) {
+							String mvalue = (String) RealLabels.durationGroup.get(mkey);
+							durationClass = mvalue;
+							break;
+						}
+					}
+	
+					// get fault class
+					LinkedList<Double> ll2 = new LinkedList<Double>(
+							RealLabels.failureCause.keySet());
+					Collections.sort(ll2);
+					Iterator iterator2 = ll2.iterator();
+					while (iterator2.hasNext()) {
+						double mkey = (Double) iterator2.next();
+						if (failure <= mkey) {
+							String mvalue = (String) RealLabels.failureCause.get(mkey);
+							faultClass = mvalue;
+							break;
+						}
+					}
+	
+					if(faultClass.compareTo("") == 0)
+						faultClass = "TYPING";
+	
+					DataBag output = DefaultBagFactory.getInstance().newDefaultBag();
+					Tuple t = DefaultTupleFactory.getInstance().newTuple(1);
+					String label = durationClass + " event - " + faultClass+ " fault";
+					//System.out.println("label="+label);
+					t.set(0, label);
+					
+	                output.add(t);
+	                return output;
+        	}
+        	return null;
+            
+            
+        }catch(Exception e){
+            System.err.println("RealLabelsr: failed to process input; error - " + e.getMessage());
+            e.printStackTrace();
+            return null;
+        }
+
+
+    }
+}
Index: /proiecte/PDAD/trunk/failurecause/pig/local/failurecause.pig
===================================================================
--- /proiecte/PDAD/trunk/failurecause/pig/local/failurecause.pig	(revision 154)
+++ /proiecte/PDAD/trunk/failurecause/pig/local/failurecause.pig	(revision 154)
@@ -0,0 +1,20 @@
+-- This script processes failure cause for different categories of events grouped by duration (short, medium, long)
+
+-- author: cristina
+
+REGISTER failurecausefunc.jar;
+
+raw = LOAD '$inputDir/event_trace.tab' USING PigStorage('\t') AS (event_id,component_id,node_id,platform_id,node_name,event_type,event_start_time,event_stop_time,event_end_reason:chararray);
+
+-- build durations
+duration = FOREACH raw GENERATE event_stop_time-event_start_time as dur, event_end_reason as fault;
+mapping = FOREACH duration GENERATE flatten(RealLabels(dur, fault)) as key, 1 as value;
+--filteredMapping = FILTER mapping BY key!=NULL;
+
+
+-- group and average
+grup = GROUP mapping BY key;
+rez = FOREACH grup GENERATE group, SUM(mapping.value) as sum;
+filteredRez = FILTER rez BY sum > 1000;
+
+STORE filteredRez INTO 'failurecause.rez' USING PigStorage();
Index: /proiecte/PDAD/trunk/failurecause/pig/local/jar.sh
===================================================================
--- /proiecte/PDAD/trunk/failurecause/pig/local/jar.sh	(revision 154)
+++ /proiecte/PDAD/trunk/failurecause/pig/local/jar.sh	(revision 154)
@@ -0,0 +1,6 @@
+#! /bin/sh
+
+mkdir failurecausefunc
+javac -classpath $PIGDIR/pig.jar -d failurecausefunc RealLabels.java
+jar -cvf failurecausefunc.jar -C failurecausefunc/ .
+rm -r failurecausefunc
Index: /proiecte/PDAD/trunk/failurecause/pig/local/run.sh
===================================================================
--- /proiecte/PDAD/trunk/failurecause/pig/local/run.sh	(revision 154)
+++ /proiecte/PDAD/trunk/failurecause/pig/local/run.sh	(revision 154)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+rm failurecause.rez
+java -cp $PIGDIR/pig.jar org.apache.pig.Main -x local -param inputDir=$PP_TESTS_DIR failurecause.pig
+vim failurecause.rez 
+
Index: /proiecte/PDAD/trunk/failurecause/pig/mr/RealLabels.java
===================================================================
--- /proiecte/PDAD/trunk/failurecause/pig/mr/RealLabels.java	(revision 154)
+++ /proiecte/PDAD/trunk/failurecause/pig/mr/RealLabels.java	(revision 154)
@@ -0,0 +1,113 @@
+import java.io.IOException;
+import java.util.*;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataBag;
+import org.apache.pig.data.DefaultBagFactory;
+import org.apache.pig.data.DefaultTupleFactory;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.apache.pig.data.DataType;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+
+public class RealLabels extends EvalFunc<DataBag> {
+
+	public static HashMap<Double, String> failureCause = new HashMap<Double, String>();
+	public static HashMap<Double, String> durationGroup = new HashMap<Double, String>();
+	
+	public static void init() {
+		// failure cause
+		failureCause.put(new Double(-1), "not reported");
+		failureCause.put(new Double(0), "reported as undetermined");
+		failureCause.put(new Double(999), "infrastructure");
+		failureCause.put(new Double(1999), "hardware");
+		failureCause.put(new Double(2999), "IO");
+		failureCause.put(new Double(3999), "network");
+		failureCause.put(new Double(4999), "software");
+		failureCause.put(new Double(5999), "human error");
+		failureCause.put(new Double(6999), "user");
+		failureCause.put(new Double(7000), "end of measurement");
+
+		// group by duration
+		durationGroup.put(new Double(1000), "short");
+		durationGroup.put(new Double(100000), "medium");
+		durationGroup.put(Double.MAX_VALUE, "long");
+	}
+
+    @Override
+    public DataBag exec(Tuple input) throws IOException {
+    	RealLabels.init();
+
+	if (input == null || input.size() == 0)
+            return null;
+        try{
+
+        	Double duration = (Double)input.get(0);
+        	//System.out.println("duration="+duration);
+        	Double failure = new Double(0);
+        	if(duration != null && failure != null) {
+		
+				String f = new String(input.get(1).toString());
+				StringTokenizer st = new StringTokenizer(f);
+				String token = st.nextToken();
+				if(token.compareTo("NULL") == 0)
+					failure = -1.0;
+				else
+					failure = Double.parseDouble(token);
+				
+				//System.out.println("failure="+failure);
+				String durationClass = "", faultClass = "";
+		
+				// get duration class
+					LinkedList<Double> ll1 = new LinkedList<Double>(
+							RealLabels.durationGroup.keySet());
+					Collections.sort(ll1);
+					Iterator iterator1 = ll1.iterator();
+					while (iterator1.hasNext()) {
+						double mkey = (Double) iterator1.next();
+						if (duration <= mkey) {
+							String mvalue = (String) RealLabels.durationGroup.get(mkey);
+							durationClass = mvalue;
+							break;
+						}
+					}
+	
+					// get fault class
+					LinkedList<Double> ll2 = new LinkedList<Double>(
+							RealLabels.failureCause.keySet());
+					Collections.sort(ll2);
+					Iterator iterator2 = ll2.iterator();
+					while (iterator2.hasNext()) {
+						double mkey = (Double) iterator2.next();
+						if (failure <= mkey) {
+							String mvalue = (String) RealLabels.failureCause.get(mkey);
+							faultClass = mvalue;
+							break;
+						}
+					}
+	
+					if(faultClass.compareTo("") == 0)
+						faultClass = "TYPING";
+	
+					DataBag output = DefaultBagFactory.getInstance().newDefaultBag();
+					Tuple t = DefaultTupleFactory.getInstance().newTuple(1);
+					String label = durationClass + " event - " + faultClass+ " fault";
+					//System.out.println("label="+label);
+					t.set(0, label);
+					
+	                output.add(t);
+	                return output;
+        	}
+        	return null;
+            
+            
+        }catch(Exception e){
+            System.err.println("RealLabelsr: failed to process input; error - " + e.getMessage());
+            e.printStackTrace();
+            return null;
+        }
+
+
+    }
+}
Index: /proiecte/PDAD/trunk/failurecause/pig/mr/failurecause.pig
===================================================================
--- /proiecte/PDAD/trunk/failurecause/pig/mr/failurecause.pig	(revision 154)
+++ /proiecte/PDAD/trunk/failurecause/pig/mr/failurecause.pig	(revision 154)
@@ -0,0 +1,20 @@
+-- This script processes failure cause for different categories of events grouped by duration (short, medium, long)
+
+-- author: cristina
+
+REGISTER failurecausefunc.jar;
+
+raw = LOAD '$inputDir/event_trace.tab' USING PigStorage('\t') AS (event_id,component_id,node_id,platform_id,node_name,event_type,event_start_time,event_stop_time,event_end_reason:chararray);
+
+-- build durations
+duration = FOREACH raw GENERATE event_stop_time-event_start_time as dur, event_end_reason as fault;
+mapping = FOREACH duration GENERATE flatten(RealLabels(dur, fault)) as key, 1 as value;
+--filteredMapping = FILTER mapping BY key!=NULL;
+
+
+-- group and average
+grup = GROUP mapping BY (chararray)key;
+rez = FOREACH grup GENERATE group, SUM(mapping.value) as sum;
+filteredRez = FILTER rez BY sum > 1000;
+
+STORE filteredRez INTO '$outputDir' USING PigStorage();
Index: /proiecte/PDAD/trunk/failurecause/pig/mr/jar.sh
===================================================================
--- /proiecte/PDAD/trunk/failurecause/pig/mr/jar.sh	(revision 154)
+++ /proiecte/PDAD/trunk/failurecause/pig/mr/jar.sh	(revision 154)
@@ -0,0 +1,6 @@
+#! /bin/sh
+
+mkdir failurecausefunc
+javac -cp $PIG_CLASSPATH -d failurecausefunc RealLabels.java
+jar -cvf failurecausefunc.jar -C failurecausefunc/ .
+rm -r failurecausefunc
Index: /proiecte/PDAD/trunk/failurecause/pig/mr/run.sh
===================================================================
--- /proiecte/PDAD/trunk/failurecause/pig/mr/run.sh	(revision 154)
+++ /proiecte/PDAD/trunk/failurecause/pig/mr/run.sh	(revision 154)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+$HADOOP_HOME/bin/hadoop fs -rmr output/failurecause/pig/$1
+java -cp $PIG_CLASSPATH org.apache.pig.Main -param inputDir=/user/hadoop/input/$1/event_trace -param outputDir=output/failurecause/pig/$1 -x mapreduce failurecause.pig
+$HADOOP_HOME/bin/hadoop fs -cat output/failurecause/pig/$1/part-00000
+
Index: /proiecte/PDAD/trunk/jar_cristina.sh
===================================================================
--- /proiecte/PDAD/trunk/jar_cristina.sh	(revision 154)
+++ /proiecte/PDAD/trunk/jar_cristina.sh	(revision 154)
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+cd ./failurecause/mapreduce
+./jar.sh
+cd ../../mediumevents_s/mapreduce
+./jar.sh
+cd ../../mediumevents/mapreduce
+./jar.sh
+cd ../../nodeslocation/mapreduce
+./jar.sh
+
+cd ../../endreason
+make build
+cd ../comptype
+make build
+cd ../endreasonstat
+make build
+
Index: /proiecte/PDAD/trunk/jar_pig_cristina.sh
===================================================================
--- /proiecte/PDAD/trunk/jar_pig_cristina.sh	(revision 154)
+++ /proiecte/PDAD/trunk/jar_pig_cristina.sh	(revision 154)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+cd failurecause/pig/mr
+./jar.sh
+cd ../../../nodeslocation/pig/mr
+./jar.sh
Index: /proiecte/PDAD/trunk/mediumevents/mapreduce/MediumEvents.java
===================================================================
--- /proiecte/PDAD/trunk/mediumevents/mapreduce/MediumEvents.java	(revision 154)
+++ /proiecte/PDAD/trunk/mediumevents/mapreduce/MediumEvents.java	(revision 154)
@@ -0,0 +1,173 @@
+/**
+ * Medium length for events
+ * 
+ * @author cristina
+ */
+
+package org.PP;
+
+import java.io.IOException;
+import java.util.*;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.conf.*;
+import org.apache.hadoop.io.*;
+import org.apache.hadoop.mapred.*;
+import org.apache.hadoop.util.*;
+
+public class MediumEvents {
+
+	public static class Map extends MapReduceBase implements
+			Mapper<LongWritable, Text, Text, DoubleWritable> {
+		private static Text label = new Text();
+		static long anotherLabel = 0; // groups data by generating a new lable
+										// each 1000 entries
+		static long labels = 0; // number of keys generated
+
+		public enum MapDuration {
+			AHAM
+		};
+
+		public void map(LongWritable key, Text value,
+				OutputCollector<Text, DoubleWritable> output, Reporter reporter)
+				throws IOException {
+
+			Map.label.set("medium duration " + Map.labels);
+
+			if (Map.anotherLabel == 1000) {
+				Map.anotherLabel = 0;
+				Map.labels++;
+
+				// reporter.setStatus("map " + label.toString());
+				reporter.incrCounter(MapDuration.AHAM, 1);
+			}
+
+			String line = value.toString();
+			// skip comments
+			if (!line.startsWith("#")) {
+				// collons 7 and 8 are start, end time of job respectively
+				StringTokenizer tokenizer = new StringTokenizer(line);
+				int count = 0;
+				Double start = new Double(0), end = new Double(0), duration = new Double(
+						0);
+				anotherLabel++;
+				while (tokenizer.hasMoreTokens()) {
+					count++;
+					String token = tokenizer.nextToken();
+					if (count == 7)
+						start = Double.parseDouble(token);
+					if (count == 8) {
+						end = Double.parseDouble(token);
+						// stop, we have all the information
+						break;
+					}
+				}
+
+				duration = end - start;
+				output.collect(label, new DoubleWritable(duration));
+			}
+		}
+	}
+
+	public static class Combiner extends MapReduceBase implements
+			Reducer<Text, DoubleWritable, Text, DoubleWritable> {
+
+		public void reduce(Text key, Iterator<DoubleWritable> values,
+				OutputCollector<Text, DoubleWritable> output, Reporter reporter)
+				throws IOException {
+			Double sum = new Double(0);
+			Long count = new Long(0);
+			Double med = new Double(0);
+
+			while (values.hasNext()) {
+				count++;
+				sum += values.next().get();
+			}
+			if (count > 0)
+				med = sum / count;
+			else
+				med = new Double(0);
+			output.collect(new Text("medium duration"), new DoubleWritable(med));
+
+		}
+	}
+
+	public static class Reduce extends MapReduceBase implements
+	Reducer<Text, DoubleWritable, Text, DoubleWritable> {
+
+	public void reduce(Text key, Iterator<DoubleWritable> values,
+			OutputCollector<Text, DoubleWritable> output, Reporter reporter)
+			throws IOException {
+		Double sum = new Double(0);
+		Long count = new Long(0);
+		Double med = new Double(0);
+	
+		while (values.hasNext()) {
+			count++;
+			sum += values.next().get();
+		}
+		if (count > 0)
+			med = sum / count;
+		else
+			med = new Double(0);
+		output.collect(key, new DoubleWritable(med));
+	
+	}
+}
+	
+	/*
+	 * public static class Reduce extends MapReduceBase implements Reducer<Text,
+	 * DoubleWritable, Text, DoubleWritable> {
+	 * 
+	 * static Text label = new Text(); static long anotherLabel = 0; // groups
+	 * data by generating a new lable each 1.000.000 entries static long labels
+	 * = 0; // number of keys generated
+	 * 
+	 * public enum RedDuration { AHAM };
+	 * 
+	 * 
+	 * public void reduce(Text key, Iterator<DoubleWritable> values,
+	 * OutputCollector<Text, DoubleWritable> output, Reporter reporter) throws
+	 * IOException { Double sum = new Double(0); Long count = new Long(0);
+	 * Double med = new Double(0);
+	 * 
+	 * Reduce.label.set("medium duration "+Reduce.labels);
+	 * 
+	 * if(Reduce.anotherLabel == 100) { Reduce.anotherLabel = 0;
+	 * Reduce.labels++;
+	 * 
+	 * //reporter.setStatus("map " + label.toString());
+	 * reporter.incrCounter(RedDuration.AHAM, 1); }
+	 * 
+	 * Reduce.anotherLabel++;
+	 * 
+	 * 
+	 * while (values.hasNext()) { count++; sum += values.next().get(); }
+	 * if(count > 0) med = sum/count; else med = new Double(0);
+	 * output.collect(Reduce.label, new DoubleWritable(med));
+	 * 
+	 * } }
+	 */
+
+	public static void main(String[] args) throws Exception {
+		JobConf conf = new JobConf(MediumEvents.class);
+		conf.setJobName("mediumEvents");
+
+		conf.setOutputKeyClass(Text.class);
+		conf.setOutputValueClass(DoubleWritable.class);
+
+		conf.setMapperClass(Map.class);
+		conf.setCombinerClass(Combiner.class);
+		conf.setReducerClass(Reduce.class);
+
+		conf.setInputFormat(TextInputFormat.class);
+		conf.setOutputFormat(TextOutputFormat.class);
+
+		FileInputFormat.setInputPaths(conf, new Path(args[0]));
+		FileOutputFormat.setOutputPath(conf, new Path(args[1]));
+
+		conf.setNumReduceTasks(5);
+
+		JobClient.runJob(conf);
+	}
+}
Index: /proiecte/PDAD/trunk/mediumevents/mapreduce/jar.sh
===================================================================
--- /proiecte/PDAD/trunk/mediumevents/mapreduce/jar.sh	(revision 154)
+++ /proiecte/PDAD/trunk/mediumevents/mapreduce/jar.sh	(revision 154)
@@ -0,0 +1,7 @@
+# ar trebui facut intr-un script ant
+
+mkdir medium_classes
+javac -classpath $HADOOP_HOME/hadoop-0.20.1-core.jar -d medium_classes MediumEvents.java
+jar -cvf mediumevents.jar -C medium_classes/ .
+rm -r medium_classes
+
Index: /proiecte/PDAD/trunk/mediumevents/mapreduce/run.sh
===================================================================
--- /proiecte/PDAD/trunk/mediumevents/mapreduce/run.sh	(revision 154)
+++ /proiecte/PDAD/trunk/mediumevents/mapreduce/run.sh	(revision 154)
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+
+$HADOOP_HOME/bin/hadoop fs -rmr output/mediumevents/$1
+$HADOOP_HOME/bin/hadoop jar mediumevents.jar org.PP.MediumEvents /user/hadoop/input/$1/event_trace/event_trace.tab /user/hadoop/output/mediumevents/$1
+echo "Result available in /user/hadoop/output/mediumevents/$1: $HADOOP_HOME/bin/hadoop fs -cat /user/hadoop/output/mediumevents/$1/part-00000"
+echo "-------------------------"
+echo "PRINTING..."
+echo "-------------------------"
+$HADOOP_HOME/bin/hadoop fs -cat /user/hadoop/output/mediumevents/$1/part-00000
Index: /proiecte/PDAD/trunk/mediumevents/pig/local/mediumevents_avg.pig
===================================================================
--- /proiecte/PDAD/trunk/mediumevents/pig/local/mediumevents_avg.pig	(revision 154)
+++ /proiecte/PDAD/trunk/mediumevents/pig/local/mediumevents_avg.pig	(revision 154)
@@ -0,0 +1,15 @@
+-- This script processes medium length for events
+
+-- author: cristina
+
+
+raw = LOAD '$inputDir/event_trace.tab' USING PigStorage('\t') AS (event_id,component_id,node_id,platform_id,node_name,event_type,event_start_time,event_stop_time,event_end_reason);
+
+-- build durations
+duration = FOREACH raw GENERATE 'medium duration' as id, event_stop_time-event_start_time as dur;
+
+-- group and average
+grup = GROUP duration BY id;
+rez = FOREACH grup GENERATE group, AVG(duration.dur) as avg;
+
+STORE rez INTO 'mediumevents_avg.rez' USING PigStorage();
Index: /proiecte/PDAD/trunk/mediumevents/pig/local/run.sh
===================================================================
--- /proiecte/PDAD/trunk/mediumevents/pig/local/run.sh	(revision 154)
+++ /proiecte/PDAD/trunk/mediumevents/pig/local/run.sh	(revision 154)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+rm mediumevents_avg.rez
+java -cp $PIGDIR/pig.jar org.apache.pig.Main -x local -param inputDir=$PP_TESTS_DIR mediumevents_avg.pig
+vim mediumevents_avg.rez 
+
Index: /proiecte/PDAD/trunk/mediumevents/pig/mr/mediumevents_avg_mr.pig
===================================================================
--- /proiecte/PDAD/trunk/mediumevents/pig/mr/mediumevents_avg_mr.pig	(revision 154)
+++ /proiecte/PDAD/trunk/mediumevents/pig/mr/mediumevents_avg_mr.pig	(revision 154)
@@ -0,0 +1,14 @@
+-- This script processes medium length for events
+
+-- author: cristina
+
+raw = LOAD '$inputDir/event_trace.tab' USING PigStorage('\t') AS (event_id,component_id,node_id,platform_id,node_name,event_type,event_start_time,event_stop_time,event_end_reason);
+
+-- build durations
+duration = FOREACH raw GENERATE 'medium duration' as id, event_stop_time-event_start_time as dur;
+
+-- group and average
+grup = GROUP duration BY id;
+rez = FOREACH grup GENERATE group, AVG(duration.dur) as avg;
+
+STORE rez INTO '$outputDir' USING PigStorage();
Index: /proiecte/PDAD/trunk/mediumevents/pig/mr/run.sh
===================================================================
--- /proiecte/PDAD/trunk/mediumevents/pig/mr/run.sh	(revision 154)
+++ /proiecte/PDAD/trunk/mediumevents/pig/mr/run.sh	(revision 154)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+$HADOOP_HOME/bin/hadoop fs -rmr output/mediumevents/pig/$1
+java -cp $PIG_CLASSPATH org.apache.pig.Main -param inputDir=/user/hadoop/input/$1/event_trace -param outputDir=output/mediumevents/pig/$1 mediumevents_avg_mr.pig
+$HADOOP_HOME/bin/hadoop fs -cat output/mediumevents/pig/$1/part-00000
+
Index: /proiecte/PDAD/trunk/mediumevents/pig/mr/run_mr.sh
===================================================================
--- /proiecte/PDAD/trunk/mediumevents/pig/mr/run_mr.sh	(revision 154)
+++ /proiecte/PDAD/trunk/mediumevents/pig/mr/run_mr.sh	(revision 154)
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+$HADOOP_HOME/bin/hadoop fs -rmr output/mediumevents
+$HADOOP_HOME/bin/hadoop fs -rm input/mediumevents/event_trace.tab
+$HADOOP_HOME/bin/hadoop fs -put $PP_TESTS_DIR/event_trace.tab input/mediumevents/event_trace.tab
+java -cp $PIGDIR/pig.jar org.apache.pig.Main -param inputDir=$PP_TESTS_DIR mediumevents_avg_mr.pig
+$HADOOP_HOME/bin/hadoop fs -cat /user/cristina/output/mediumevents/mediumevents_avg.rez
+
Index: /proiecte/PDAD/trunk/mediumevents_s/mapreduce/MediumEvents_straight.java
===================================================================
--- /proiecte/PDAD/trunk/mediumevents_s/mapreduce/MediumEvents_straight.java	(revision 154)
+++ /proiecte/PDAD/trunk/mediumevents_s/mapreduce/MediumEvents_straight.java	(revision 154)
@@ -0,0 +1,99 @@
+/**
+ * Medium length for events
+ * 
+ * @author cristina
+ */
+
+package org.PP;
+
+import java.io.IOException;
+import java.util.*;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.conf.*;
+import org.apache.hadoop.io.*;
+import org.apache.hadoop.mapred.*;
+import org.apache.hadoop.util.*;
+
+public class MediumEvents_straight {
+
+	public static class Map extends MapReduceBase implements
+			Mapper<LongWritable, Text, Text, DoubleWritable> {
+		
+		public void map(LongWritable key, Text value,
+				OutputCollector<Text, DoubleWritable> output, Reporter reporter)
+				throws IOException {
+
+			String line = value.toString();
+			// skip comments
+			if (!line.startsWith("#")) {
+				// collons 7 and 8 are start, end time of job respectively
+				StringTokenizer tokenizer = new StringTokenizer(line);
+				int count = 0;
+				Double start = new Double(0), end = new Double(0), duration = new Double(
+						0);
+				while (tokenizer.hasMoreTokens()) {
+					count++;
+					String token = tokenizer.nextToken();
+					if (count == 7)
+						start = Double.parseDouble(token);
+					if (count == 8) {
+						end = Double.parseDouble(token);
+						// stop, we have all the information
+						break;
+					}
+				}
+
+				duration = end - start;
+				output.collect(new Text("medium duration"), new DoubleWritable(duration));
+			}
+		}
+	}
+
+	public static class Reduce extends MapReduceBase implements
+	Reducer<Text, DoubleWritable, Text, DoubleWritable> {
+
+	public void reduce(Text key, Iterator<DoubleWritable> values,
+			OutputCollector<Text, DoubleWritable> output, Reporter reporter)
+			throws IOException {
+		Double sum = new Double(0);
+		Long count = new Long(0);
+		Double med = new Double(0);
+	
+		while (values.hasNext()) {
+			count++;
+			sum += values.next().get();
+		}
+		if (count > 0)
+			med = sum / count;
+		else
+			med = new Double(0);
+		output.collect(key, new DoubleWritable(med));
+	
+	}
+}
+	
+	
+
+	public static void main(String[] args) throws Exception {
+		JobConf conf = new JobConf(MediumEvents_straight.class);
+		conf.setJobName("MediumEvents_straight");
+
+		conf.setOutputKeyClass(Text.class);
+		conf.setOutputValueClass(DoubleWritable.class);
+
+		conf.setMapperClass(Map.class);
+		//conf.setCombinerClass(Reduce.class); !! there shouldn't be any reducer as it approximates!!
+		conf.setReducerClass(Reduce.class);
+
+		conf.setInputFormat(TextInputFormat.class);
+		conf.setOutputFormat(TextOutputFormat.class);
+
+		FileInputFormat.setInputPaths(conf, new Path(args[0]));
+		FileOutputFormat.setOutputPath(conf, new Path(args[1]));
+
+		conf.setNumReduceTasks(5);
+
+		JobClient.runJob(conf);
+	}
+}
Index: /proiecte/PDAD/trunk/mediumevents_s/mapreduce/jar.sh
===================================================================
--- /proiecte/PDAD/trunk/mediumevents_s/mapreduce/jar.sh	(revision 154)
+++ /proiecte/PDAD/trunk/mediumevents_s/mapreduce/jar.sh	(revision 154)
@@ -0,0 +1,7 @@
+# ar trebui facut intr-un script ant
+
+mkdir medium_classes
+javac -classpath $HADOOP_HOME/hadoop-0.20.1-core.jar -d medium_classes MediumEvents_straight.java
+jar -cvf mediumevents_s.jar -C medium_classes/ .
+rm -r medium_classes
+
Index: /proiecte/PDAD/trunk/mediumevents_s/mapreduce/run.sh
===================================================================
--- /proiecte/PDAD/trunk/mediumevents_s/mapreduce/run.sh	(revision 154)
+++ /proiecte/PDAD/trunk/mediumevents_s/mapreduce/run.sh	(revision 154)
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+
+$HADOOP_HOME/bin/hadoop fs -rmr output/mediumevents_s/$1
+$HADOOP_HOME/bin/hadoop jar mediumevents_s.jar org.PP.MediumEvents_straight /user/hadoop/input/$1/event_trace/event_trace.tab /user/hadoop/output/mediumevents_s/$1
+echo "Result available in /user/hadoop/output/mediumevents_s/$1: $HADOOP_HOME/bin/hadoop fs -cat /user/hadoop/output/mediumevents_s/$1/part-00000"
+echo "-------------------------"
+echo "PRINTING..."
+echo "-------------------------"
+$HADOOP_HOME/bin/hadoop fs -cat /user/hadoop/output/mediumevents_s/$1/part-00000
Index: /proiecte/PDAD/trunk/mediumevents_s/pig/local/mediumevents_avg.pig
===================================================================
--- /proiecte/PDAD/trunk/mediumevents_s/pig/local/mediumevents_avg.pig	(revision 154)
+++ /proiecte/PDAD/trunk/mediumevents_s/pig/local/mediumevents_avg.pig	(revision 154)
@@ -0,0 +1,15 @@
+-- This script processes medium length for events
+
+-- author: cristina
+
+
+raw = LOAD '$inputDir/event_trace.tab' USING PigStorage('\t') AS (event_id,component_id,node_id,platform_id,node_name,event_type,event_start_time,event_stop_time,event_end_reason);
+
+-- build durations
+duration = FOREACH raw GENERATE 'medium duration' as id, event_stop_time-event_start_time as dur;
+
+-- group and average
+grup = GROUP duration BY id;
+rez = FOREACH grup GENERATE group, AVG(duration.dur) as avg;
+
+STORE rez INTO 'mediumevents_avg.rez' USING PigStorage();
Index: /proiecte/PDAD/trunk/mediumevents_s/pig/local/run.sh
===================================================================
--- /proiecte/PDAD/trunk/mediumevents_s/pig/local/run.sh	(revision 154)
+++ /proiecte/PDAD/trunk/mediumevents_s/pig/local/run.sh	(revision 154)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+rm mediumevents_avg.rez
+java -cp $PIGDIR/pig.jar org.apache.pig.Main -param inputDir=$PP_TESTS_DIR -x local mediumevents_avg.pig
+vim mediumevents_avg.rez 
+
Index: /proiecte/PDAD/trunk/mediumevents_s/pig/mr/mediumevents_avg_mr.pig
===================================================================
--- /proiecte/PDAD/trunk/mediumevents_s/pig/mr/mediumevents_avg_mr.pig	(revision 154)
+++ /proiecte/PDAD/trunk/mediumevents_s/pig/mr/mediumevents_avg_mr.pig	(revision 154)
@@ -0,0 +1,14 @@
+-- This script processes medium length for events
+
+-- author: cristina
+
+raw = LOAD '$inputDir/event_trace.tab' USING PigStorage('\t') AS (event_id,component_id,node_id,platform_id,node_name,event_type,event_start_time,event_stop_time,event_end_reason);
+
+-- build durations
+duration = FOREACH raw GENERATE 'medium duration' as id, event_stop_time-event_start_time as dur;
+
+-- group and average
+grup = GROUP duration BY id;
+rez = FOREACH grup GENERATE group, AVG(duration.dur) as avg;
+
+STORE rez INTO '$outputDir' USING PigStorage();
Index: /proiecte/PDAD/trunk/mediumevents_s/pig/mr/run.sh
===================================================================
--- /proiecte/PDAD/trunk/mediumevents_s/pig/mr/run.sh	(revision 154)
+++ /proiecte/PDAD/trunk/mediumevents_s/pig/mr/run.sh	(revision 154)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+$HADOOP_HOME/bin/hadoop fs -rmr output/mediumevents_s/pig/$1
+java -cp $PIG_CLASSPATH org.apache.pig.Main -param inputDir=/user/hadoop/input/$1/event_trace -param outputDir=output/mediumevents_s/pig/$1 mediumevents_avg_mr.pig
+$HADOOP_HOME/bin/hadoop fs -cat output/mediumevents_s/pig/$1/part-00000
+
Index: /proiecte/PDAD/trunk/mediumevents_s/pig/mr/run_mr.sh
===================================================================
--- /proiecte/PDAD/trunk/mediumevents_s/pig/mr/run_mr.sh	(revision 154)
+++ /proiecte/PDAD/trunk/mediumevents_s/pig/mr/run_mr.sh	(revision 154)
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+$HADOOP_HOME/bin/hadoop fs -rmr output/mediumevents
+$HADOOP_HOME/bin/hadoop fs -rm input/mediumevents/event_trace.tab
+$HADOOP_HOME/bin/hadoop fs -put $PP_TESTS_DIR/event_trace.tab input/mediumevents/event_trace.tab
+java -cp $PIGDIR/pig.jar org.apache.pig.Main -param inputDir=$PP_TESTS_DIR mediumevents_avg_mr.pig
+$HADOOP_HOME/bin/hadoop fs -cat /user/cristina/output/mediumevents/mediumevents_avg.rez
+
Index: /proiecte/PDAD/trunk/nodeslocation/mapreduce/NodesLocation.java
===================================================================
--- /proiecte/PDAD/trunk/nodeslocation/mapreduce/NodesLocation.java	(revision 154)
+++ /proiecte/PDAD/trunk/nodeslocation/mapreduce/NodesLocation.java	(revision 154)
@@ -0,0 +1,278 @@
+/**
+ * Number of faults per geographical location.
+ * 
+ * @author cristina
+ */
+
+package org.PP;
+
+import java.util.*;
+import java.util.concurrent.atomic.*;
+import java.io.*;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.filecache.DistributedCache;
+import org.apache.hadoop.conf.*;
+import org.apache.hadoop.io.*;
+import org.apache.hadoop.mapred.*;
+import org.apache.hadoop.util.*;
+
+public class NodesLocation {
+
+	public static class Map extends MapReduceBase implements
+			Mapper<LongWritable, Text, Text, Text> {
+
+		static Text valOne = new Text("1");		
+
+		public void map(LongWritable key, Text value,
+				OutputCollector<Text, Text> output, Reporter reporter)
+				throws IOException {
+			
+			Text label = new Text();
+			String line = value.toString();
+			Text valLoc = new Text();
+			
+
+			// skip comments
+			if (!line.startsWith("#")) {
+			
+				Integer nodeId = new Integer(0), platformId = new Integer(0);
+				String nodeLocation = "";
+				int count = 0;
+
+				StringTokenizer tokenizer = new StringTokenizer(line);
+				String token = "";
+				
+				if(tokenizer.countTokens() == 9) {
+					count = 0;
+					// event_trace file
+					while (tokenizer.hasMoreTokens()) {
+					
+						token = tokenizer.nextToken();
+						if (count == 2)
+							nodeId = Integer.parseInt(token);
+						if (count == 3)
+							platformId = Integer.parseInt(token);
+						count++;	
+					}
+					String skey = nodeId+";"+platformId;
+					label.set(skey);
+					output.collect(label, valOne);
+				}
+				else {
+					// nodes file
+					tokenizer = new StringTokenizer(line);
+					count = 0;
+					while (tokenizer.hasMoreTokens()) {
+						token = tokenizer.nextToken();
+				        	if(count == 0)
+				        		nodeId = Integer.parseInt(token);
+				        	if(count == 1)
+				        		platformId = Integer.parseInt(token);
+				        	if(count == 4) {
+				        		nodeLocation = token;
+							//System.out.println("locatia citita e "+token);
+				        		break;
+				        	}
+						count++;
+					}
+					String skey = nodeId+";"+platformId;
+					label.set(skey);
+					valLoc.set(nodeLocation);
+					//System.out.println("generez locatia "+nodeLocation);
+					output.collect(label, valLoc);
+				}
+
+			}
+		}
+	}
+
+
+	public static class Combine extends MapReduceBase implements
+			Reducer<Text, Text, Text, Text> {
+
+
+		public void reduce(Text key, Iterator<Text> values,
+				OutputCollector<Text, Text> output, Reporter reporter)
+				throws IOException {
+
+			Long sum = new Long(0);
+			Text val = new Text();
+			Text location = new Text();
+
+			System.out.println("in combiner cheia "+key);
+			// sum them
+			while (values.hasNext()) {
+				String crt = values.next().toString();
+				try {
+					sum += Long.parseLong(crt);
+				}
+				catch (Exception e) {
+					location.set(crt);
+					System.out.println("in combiner am gasit locatia " + crt);
+				}
+				/*
+				if(crt.compareTo("1") == 0) {
+					System.out.println("in combiner am gasit 1");
+					sum ++;
+				}
+				else {
+					System.out.println("in combiner am gasit locatia " + crt);
+					location.set(crt);
+				}
+				*/
+			}
+
+			//System.out.println("din combiner sum e "+sum);
+			val.set(sum.toString());
+			output.collect(key, val);
+			//output.collect(key, val);
+			//output.collect(key, location);
+			if(location.toString().compareTo("") != 0)
+				output.collect(key, location);
+			//System.out.println("din combiner generez locatia "+location);
+
+
+		}
+	}
+
+
+	public static class Map2 extends MapReduceBase implements
+			Mapper<LongWritable, Text, Text, LongWritable> {
+
+		static Text valOne = new Text("1");		
+
+		public void map(LongWritable key, Text value,
+				OutputCollector<Text, LongWritable> output, Reporter reporter)
+				throws IOException {
+			
+			Text label = new Text();
+			LongWritable val = new LongWritable();
+			String line = value.toString();
+			
+			Long lval = new Long(0);
+			String location = "";
+			StringTokenizer tokenizer = new StringTokenizer(line);
+			if(tokenizer.hasMoreTokens()) {
+				location = tokenizer.nextToken();
+				if(tokenizer.hasMoreTokens()) {
+					lval = Long.parseLong(tokenizer.nextToken());
+					label.set(location);
+					val.set(lval);	
+					output.collect(label, val);
+				}
+			}
+			
+		}
+	}
+
+	public static class Reduce extends MapReduceBase implements
+			Reducer<Text, Text, Text, LongWritable> {
+
+		
+
+		public void reduce(Text key, Iterator<Text> values,
+				OutputCollector<Text, LongWritable> output, Reporter reporter)
+				throws IOException {
+
+			Long sum = new Long(0);
+			LongWritable s = new LongWritable(0);
+			Text label = new Text();
+
+			System.out.println("INCEP cheia "+key);
+
+			// sum them
+			while (values.hasNext()) {
+				String crt = values.next().toString();
+				try {
+					
+					sum += Long.parseLong(crt);
+					System.out.println("suma e "+sum);
+					System.out.println("in reducer adun "+crt);
+				}
+				catch (Exception e) {
+					System.out.println("in reducer locatia "+crt);
+					label.set(crt);
+				}
+			}
+			
+			System.out.println("in reducer suma totala "+sum);
+			s.set(sum);
+			//output.collect(label, s);
+			output.collect(label, s);	
+		}
+	}
+
+	public static class Reduce2 extends MapReduceBase implements
+			Reducer<Text, LongWritable, Text, LongWritable> {
+
+		
+		public void reduce(Text key, Iterator<LongWritable> values,
+				OutputCollector<Text, LongWritable> output, Reporter reporter)
+				throws IOException {
+
+			Long sum = new Long(0);
+			LongWritable s = new LongWritable(0);
+			
+			// sum them
+			while (values.hasNext()) {
+				sum += values.next().get();
+			}
+			
+			//System.out.println("in reducer suma totala "+sum);
+			s.set(sum);
+			//output.collect(label, s);
+			output.collect(key, s);	
+		}
+	}
+
+	public static void main(String[] args) throws Exception {
+		
+		JobConf conf = new JobConf(NodesLocation.class);
+		conf.setJobName("nodesLocation");
+
+		conf.setMapOutputKeyClass(Text.class); 
+		conf.setMapOutputValueClass(Text.class); 
+
+		conf.setOutputKeyClass(Text.class);
+		conf.setOutputValueClass(LongWritable.class);
+
+		conf.setMapperClass(Map.class);
+		conf.setCombinerClass(Combine.class);
+		conf.setReducerClass(Reduce.class);
+
+		conf.setInputFormat(TextInputFormat.class);
+		conf.setOutputFormat(TextOutputFormat.class);
+
+		FileInputFormat.setInputPaths(conf, new Path(args[0]), new Path(args[2]));
+		FileOutputFormat.setOutputPath(conf, new Path(args[1]));
+
+		conf.setNumReduceTasks(5);
+
+		JobClient.runJob(conf);
+
+// -----
+		JobConf conf2 = new JobConf(NodesLocation.class);
+		conf2.setJobName("nodesLocation_ctd");
+
+		conf2.setMapOutputKeyClass(Text.class); 
+		conf2.setMapOutputValueClass(LongWritable.class); 		
+
+		conf2.setOutputKeyClass(Text.class);
+		conf2.setOutputValueClass(LongWritable.class);
+
+		conf2.setMapperClass(Map2.class);
+		conf.setCombinerClass(Reduce2.class);
+		conf2.setReducerClass(Reduce2.class);
+
+		conf2.setInputFormat(TextInputFormat.class);
+		conf2.setOutputFormat(TextOutputFormat.class);
+
+		FileInputFormat.setInputPaths(conf2, new Path(args[1]));
+		FileOutputFormat.setOutputPath(conf2, new Path(args[3]));
+
+		conf2.setNumReduceTasks(1);
+		JobClient.runJob(conf2);
+
+	}
+}
Index: /proiecte/PDAD/trunk/nodeslocation/mapreduce/jar.sh
===================================================================
--- /proiecte/PDAD/trunk/nodeslocation/mapreduce/jar.sh	(revision 154)
+++ /proiecte/PDAD/trunk/nodeslocation/mapreduce/jar.sh	(revision 154)
@@ -0,0 +1,7 @@
+# ar trebui facut intr-un script ant
+
+mkdir nodes_classes
+javac -classpath $HADOOP_HOME/hadoop-0.20.1-core.jar -d nodes_classes NodesLocation.java
+jar -cvf nodeslocation.jar -C nodes_classes/ .
+rm -r nodes_classes
+
Index: /proiecte/PDAD/trunk/nodeslocation/mapreduce/run.sh
===================================================================
--- /proiecte/PDAD/trunk/nodeslocation/mapreduce/run.sh	(revision 154)
+++ /proiecte/PDAD/trunk/nodeslocation/mapreduce/run.sh	(revision 154)
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+
+$HADOOP_HOME/bin/hadoop fs -rmr output/nodeslocation/$1
+$HADOOP_HOME/bin/hadoop jar nodeslocation.jar org.PP.NodesLocation /user/hadoop/input/$1/event_trace/event_trace.tab /user/hadoop/output/nodeslocation/$1 /user/hadoop/input/$1/node/node.tab /user/hadoop/output/nodeslocation/$1/ctd
+echo "Result available in /user/hadoop/output/nodeslocation/$1: $HADOOP_HOME/bin/hadoop fs -cat /user/hadoop/output/nodeslocation/$1/part-00000"
+echo "-------------------------"
+echo "PRINTING..."
+echo "-------------------------"
+#$HADOOP_HOME/bin/hadoop fs -cat /user/hadoop/output/nodeslocation/$1/part-00000
Index: /proiecte/PDAD/trunk/nodeslocation/mpi/Makefile
===================================================================
--- /proiecte/PDAD/trunk/nodeslocation/mpi/Makefile	(revision 154)
+++ /proiecte/PDAD/trunk/nodeslocation/mpi/Makefile	(revision 154)
@@ -0,0 +1,20 @@
+CC=mpicc
+CFLAGS=-g -Wall 
+NODES=4
+INPUT=event_trace.tab 
+
+build: failureCause nodesLocation 
+
+failureCause: failureCause.c 
+
+nodesLocation: nodesLocation.o hashmap.o 
+	$(CC) $^ -o $@
+
+run-fail: failureCause
+	mpiexec -n $(NODES) ./failureCause ./event_trace.tab 
+
+run-nodes: nodesLocation
+	mpiexec -n $(NODES) ./nodesLocation ./event_trace.tab ./node.tab ./out_nodes
+
+clean: 
+	rm -f ./*~ ./*.o ./failureCause ./nodesLocation 
Index: /proiecte/PDAD/trunk/nodeslocation/mpi/hashmap.c
===================================================================
--- /proiecte/PDAD/trunk/nodeslocation/mpi/hashmap.c	(revision 154)
+++ /proiecte/PDAD/trunk/nodeslocation/mpi/hashmap.c	(revision 154)
@@ -0,0 +1,205 @@
+/*
+ * hashmap.c
+ * Copyright (c) 2009 Vedant Kumar
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software 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:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * 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
+ * AUTHORS 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.
+ */
+#include <stdio.h>
+#include <string.h>
+#include "hashmap_public.h"
+
+struct key_val_map {
+    key k;
+    val v;
+};
+
+struct hashmap {
+    key_val_map *map;
+    uint32_t size;
+    uint32_t capacity;
+    uint32_t (*hash_fn)(key);
+    bool (*eq_fn)(key, key);
+#ifdef HMAP_DESTRUCTORS
+    void (*del_fn)(val);
+#endif
+#ifdef HMAP_THREAD_SAFE
+    sem_t lock;
+#endif
+};
+
+// hashmaps need a hash function, an equality function, and a destructor
+hashmap* mk_hmap(uint32_t (*hash_fn)(key),
+		 bool (*eq_fn)(key, key)
+#ifdef HMAP_DESTRUCTORS
+		 , void (*del_fn)(val)
+#endif
+		 ) {
+    
+    hashmap* hmap = (hashmap*) malloc(sizeof(hashmap));
+    hmap->map = (key_val_map*) malloc(sizeof(key_val_map) * HMAP_PRESET_SIZE);
+    bzero(hmap->map, sizeof(key_val_map) * HMAP_PRESET_SIZE); 
+    hmap->size = 0;
+    hmap->capacity = HMAP_PRESET_SIZE;
+    hmap->hash_fn = hash_fn;
+    hmap->eq_fn = eq_fn;
+#ifdef HMAP_DESTRUCTORS
+    hmap->del_fn = del_fn;
+#endif
+#ifdef HMAP_THREAD_SAFE
+    sem_init(&hmap->lock, 0, 1);
+#endif
+    return hmap;
+}
+
+void free_hmap(hashmap* hmap) {
+#ifdef HMAP_THREAD_SAFE
+    sem_wait(&hmap->lock);
+#endif
+
+#ifdef HMAP_DESTRUCTORS
+    static uint32_t it;
+    for (it=0; it < hmap->size; ++it) {
+	if (hmap->map[it].v != NULL) {
+	    hmap->del_fn(hmap->map[it].v);
+	}
+    }
+#endif
+
+    free(hmap->map);
+	
+#ifdef HMAP_THREAD_SAFE
+    sem_post(&hmap->lock);
+#endif
+
+    free(hmap);
+}
+
+static void __oa_hmap_add(key_val_map* map, uint32_t size, 
+			 uint32_t (*hash_fn)(key),
+			 key in, val out) {
+    static uint32_t hash;
+    hash = hash_fn(in) % size;
+	
+    uint32_t count = 0; 
+    while (map[hash].k != NULL) {
+	hash = (hash + 1) % size;
+	count++; 
+	if (count > size) { 
+	    fprintf(stdout, "Hashmap has no free entries \n"); 
+	    exit(0);
+	}
+    }
+	
+    map[hash].k = in;
+    map[hash].v = out;
+	
+}
+
+bool __hmap_add(hashmap* hmap, key in, val out) {
+#ifdef HMAP_THREAD_SAFE
+    sem_wait(&hmap->lock);
+#endif
+
+    // performace degrades after a certain load
+    if (((float) hmap->size) / hmap->capacity > 0.70) {
+	key_val_map* temp = (key_val_map*) malloc(sizeof(key_val_map) * hmap->capacity * HMAP_GROWTH_RATE);
+	if (temp != NULL) {
+	    //hmap->capacity *= HMAP_GROWTH_RATE;
+	} else {
+#ifdef HMAP_THREAD_SAFE
+	    sem_post(&hmap->lock);
+#endif
+	    // we're out of memory
+	    return false;
+	}
+	
+	// init new hashmap
+	bzero(temp, sizeof(key_val_map) * hmap->capacity * HMAP_GROWTH_RATE);
+
+	// re-posn all elements
+	static uint32_t it;
+	for (it=0; it < hmap->capacity; ++it) {
+	    if (hmap->map[it].k != NULL) {
+		__oa_hmap_add(temp, hmap->capacity * HMAP_GROWTH_RATE, hmap->hash_fn, hmap->map[it].k, hmap->map[it].v);
+	    }
+	}
+		
+	// swap out the old map with the new one
+	free(hmap->map);
+	hmap->map = temp;
+	hmap->capacity *= HMAP_GROWTH_RATE;
+    }
+	
+    __oa_hmap_add(hmap->map, hmap->capacity, hmap->hash_fn, in, out);
+    hmap->size += 1;
+
+#ifdef HMAP_THREAD_SAFE
+    sem_post(&hmap->lock);
+#endif
+    return true;
+}
+
+val __hmap_get(hashmap* hmap, key in) {
+#ifdef HMAP_THREAD_SAFE
+    sem_wait(&hmap->lock);
+#endif
+
+    static uint32_t hash;
+    hash = hmap->hash_fn(in) % hmap->capacity;
+    
+    while (hmap->map[hash].k != NULL) {
+	if (hmap->eq_fn(in, hmap->map[hash].k)) {
+#ifdef HMAP_THREAD_SAFE
+	    sem_post(&hmap->lock);
+#endif			
+	    return hmap->map[hash].v;
+	}
+		
+	hash = (hash + 1) % hmap->capacity;
+    }
+
+	
+#ifdef HMAP_THREAD_SAFE
+    sem_post(&hmap->lock);
+#endif
+	
+    return NULL;
+}
+
+#ifdef HMAP_MAKE_HASHFN
+// Robert Jenkins' 32 bit integer hash function
+uint32_t int_hash_fn(key in) {
+    static uint32_t a;
+    a = *((uint32_t*) in);
+	
+    a = (a+0x7ed55d16) + (a<<12);
+    a = (a^0xc761c23c) ^ (a>>19);
+    a = (a+0x165667b1) + (a<<5);
+    a = (a+0xd3a2646c) ^ (a<<9);
+    a = (a+0xfd7046c5) + (a<<3);
+    a = (a^0xb55a4f09) ^ (a>>16);
+	
+    return a;
+}
+
+bool int_eq_fn(key a, key b) {
+    return *((uint32_t*) a) == *((uint32_t*) b) ? true : false;
+}
+
+#endif
Index: /proiecte/PDAD/trunk/nodeslocation/mpi/hashmap_public.h
===================================================================
--- /proiecte/PDAD/trunk/nodeslocation/mpi/hashmap_public.h	(revision 154)
+++ /proiecte/PDAD/trunk/nodeslocation/mpi/hashmap_public.h	(revision 154)
@@ -0,0 +1,58 @@
+/*
+ * hashmap.h 
+ * Copyright (c) 2009 Vedant Kumar
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software 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:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * 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
+ * AUTHORS 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.
+ */
+
+#pragma once
+
+#define HMAP_PRESET_SIZE 	2 << 6 // use a power of 2 for faster array access
+#define HMAP_GROWTH_RATE 	2
+/* #define HMAP_MAKE_HASHFN */
+/* #define HMAP_THREAD_SAFE 	// build with -lrt */
+/* #define HMAP_DESTRUCTORS */
+
+#ifdef HMAP_THREAD_SAFE
+	#include <semaphore.h>
+#endif
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
+
+typedef void* key;
+typedef void* val;
+typedef struct key_val_map key_val_map;
+typedef struct hashmap hashmap;
+
+hashmap* mk_hmap(uint32_t (*hash_fn)(key),
+                 bool (*eq_fn)(key, key)
+#ifdef HMAP_DESTRUCTORS
+                 , void (*del_fn)(val)
+#endif
+    );
+			
+void free_hmap(hashmap*);
+
+bool __hmap_add(hashmap* hmap, key in, val out);
+#define hmap_add(hmap, in, out) __hmap_add(hmap, (key) in, (val) out)
+
+val __hmap_get(hashmap* hmap, key in);
+#define hmap_get(hmap, obj) __hmap_get(hmap, (val) obj)	
Index: /proiecte/PDAD/trunk/nodeslocation/mpi/nodesLocation.c
===================================================================
--- /proiecte/PDAD/trunk/nodeslocation/mpi/nodesLocation.c	(revision 154)
+++ /proiecte/PDAD/trunk/nodeslocation/mpi/nodesLocation.c	(revision 154)
@@ -0,0 +1,405 @@
+// Frequent (>1000) failure cause for different categories of events grouped by duration (short, medium, long)
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "mpi.h"
+#include "hashmap_public.h"
+
+#define LINEMAX 512 
+#define NAMEMAX 32 
+#define CHUNK 20480
+#define ENCODED_NO 33
+#define MAX_UNITS 10
+
+#define JOB_TAG 0 
+#define RESPONSE_TAG 1
+#define QUERY_TAG 2
+
+typedef struct location_unit {
+    char location[NAMEMAX]; 
+    unsigned long failures; 
+} location_unit; 
+
+typedef struct resp_payload {
+    int unsigned count; 
+    location_unit units[MAX_UNITS]; 
+} resp_payload; 
+
+typedef struct node_key {
+    int unsigned node_id; 
+    int unsigned platform_id; 
+} node_key; 
+
+typedef struct query_payload {
+    node_key key; 
+} query_payload; 
+
+typedef struct node_value {
+    char location[0]; 
+} node_value; 
+
+uint32_t node_hash(key generic_key) {
+    node_key *k = (node_key *) generic_key; 
+    return (k->node_id * k->platform_id); 
+}
+
+bool node_eq(key a, key b) {
+    node_key *na = (node_key *)a; 
+    node_key *nb = (node_key *)b; 
+    return (na->node_id == nb->node_id) && (na->platform_id == nb->platform_id); 
+}
+
+typedef struct loc_key {
+    char *name; 
+} loc_key; 
+
+typedef struct loc_value {
+    int unsigned failures; 
+} loc_value; 
+
+uint32_t loc_hash(key generic_key) {
+    loc_key *k = (loc_key *) generic_key; 
+    return (uint32_t)k->name[0]; 
+}
+
+bool loc_eq(key a, key b) {
+    loc_key *la = (loc_key *) a; 
+    loc_key *lb = (loc_key *) b; 
+
+    return strcmp(la->name, lb->name) == 0; 
+}
+
+
+/* for master */
+hashmap *nodes_map;
+
+/* for slaves: */
+hashmap *locations; 
+hashmap *nodes_cache; 
+ 
+unsigned long* poz;
+unsigned long recv[2];
+unsigned long poz_size = 0;
+unsigned long recv_m[ENCODED_NO];
+unsigned long send_m[ENCODED_NO];
+
+int failure_key[] = {-1, 0, 999, 1999, 2999, 3999, 4999, 5999, 6999, 7000, 7001};
+char* failure_value[] = {"not reported", "reported as undetermined", "infrastructure", "hardware", "IO", "network", "software", "human error",
+			 "user", "end of measurement", "TYPING"};
+long duration_key[] = {1000, 100000, 2147483647};
+char* duration_value[] = {"short", "medium", "long"};
+char* encoded_values[] = {"short-not reported", "medium-not reported", "long-not reported", "short-reported as undetermined",
+			  "medium-reported as undetermined", "long-reported as undetermined", "short-infrastructure", "medium-infrastructure",
+			  "long-infrastructure", "short-hardware", "medium-hardware", "long-hardware", "short-IO", "medium-IO", "long-IO", "short-network",
+			  "medium-network", "long-network", "short-software", "medium-software", "long-software", "short-human error",
+			  "medium-human error", "long-human error", "short-user", "medium-user", "long-user", "short-end of measurement",
+			  "medium-end of measurement", "long-end of measurement", "short-TYPING", "medium-TYPING", "long-TYPING"};
+
+unsigned long file_length(FILE *f) {
+    long pos;
+    long end;
+
+    pos = ftell (f);
+    fseek (f, 0, SEEK_END);
+    end = ftell (f);
+    fseek (f, pos, SEEK_SET);
+
+    return end;
+}
+
+
+void write_result (char *filename) {
+    FILE *f;
+    int i;
+
+    f = fopen(filename, "wt");
+    if (f == NULL) {
+	fprintf(stderr, "Could not open file %s for write\n", filename);
+	MPI_Abort(MPI_COMM_WORLD, 7777);
+    }
+
+    for(i = 0 ; i < ENCODED_NO ; i++) {
+	fprintf(f, "%-40s", encoded_values[i]);
+	fprintf(f, "%lu\n", recv_m[i]);
+    }
+}
+
+void load_nodes_info(char *nodes_filename) {
+    FILE *nodes_file;
+    char buffer[LINEMAX]; 
+    char node_name[NAMEMAX], node_ip[NAMEMAX], node_location[NAMEMAX]; 
+    node_key *node; 
+    node_value *value; 
+
+    /* initialize hashmap */
+    nodes_map = mk_hmap(node_hash, node_eq); 
+
+    nodes_file = fopen(nodes_filename, "rt"); 
+    if (nodes_file == NULL) { 
+	fprintf(stderr, "Could not open nodes file %s \n", nodes_filename); 
+	MPI_Abort(MPI_COMM_WORLD, 7777);
+    }
+
+    while (fgets(buffer, LINEMAX, nodes_file) != NULL) { 
+	/* skip comments */
+	if (buffer[0] == '#') 
+	    continue; 
+	
+	node = malloc(sizeof(node_key)); 
+	if (node == NULL) {
+	    fprintf(stderr, "Not enough memory \n"); 
+	    MPI_Abort(MPI_COMM_WORLD, 7777); 
+	}
+	
+	sscanf(buffer, "%u %u %s %s %s", &node->node_id, &node->platform_id, node_name, node_ip, node_location);
+	value = malloc(sizeof(node_value) + strlen(node_location) + 1); 
+	if (value == NULL) { 
+	    fprintf(stderr, "Not enough memory \n"); 
+	    MPI_Abort(MPI_COMM_WORLD, 7777); 
+	}
+
+	strcpy(value->location, node_location); 
+	if (hmap_add(nodes_map, node, value) == false) {
+	    fprintf(stderr, "Hashmap out of memory \n"); 
+	    MPI_Abort(MPI_COMM_WORLD, 7777); 
+	} 
+    }
+
+    fclose(nodes_file); 
+
+    /* 
+    node_key k;
+    k.node_id = 160; 
+    k.platform_id = 3; 
+    value = hmap_get(nodes_map, &k); 
+    if (value == NULL) {
+	printf("Error \n"); 
+    } else {
+	printf("Search result: %s \n", value->location); 
+    }
+    */
+}
+
+int init(char *filename) {
+    unsigned long file_len = 0;
+    unsigned long i, j;
+    FILE *f;
+
+    f = fopen(filename, "rt");
+    if (f == NULL) {
+	fprintf(stderr, "Could not open file init.\n");
+	MPI_Abort(MPI_COMM_WORLD, 7777);
+    }
+    file_len = file_length(f);
+    poz_size = file_len / CHUNK + 1;
+
+    poz = (unsigned long*) malloc(poz_size * sizeof(unsigned long));
+    poz[0] = 0;
+    for (i = CHUNK, j = 1; j < poz_size - 1; i += CHUNK, j++) {
+	poz[j] = i;
+    }
+    poz[j] = file_len;
+
+    return 1;
+}
+
+int main(int argc, char** argv) {
+
+    int rank, size;
+    MPI_Status status;
+    MPI_Request req;
+    int i, flag;
+    void *buffer = malloc(sizeof(resp_payload));
+    resp_payload *resp; 
+    query_payload *query; 
+
+    MPI_Init(&argc, &argv);
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+    if (rank == 0) {
+	// master inits
+	init(argv[1]);
+	load_nodes_info(argv[2]); 
+    }
+
+    MPI_Barrier(MPI_COMM_WORLD);
+
+    // master sends indexes, receives results
+    if(rank == 0) {
+
+	char null_location = 0;
+	for(i = 0 ; i < ENCODED_NO ; i++) {
+	    recv_m[i] = 0;
+	    send_m[i] = 0;
+	}
+
+	// sends indexes
+	for (i = 0; i < poz_size - 1; i++) {
+	    MPI_Isend(poz+i, 2, MPI_UNSIGNED_LONG, i%(size-1)+1, JOB_TAG, MPI_COMM_WORLD, &req);
+	}
+
+	// receive results
+	unsigned long recv_temp[ENCODED_NO];
+	while(1) {
+	    
+	    for(i = 0 ; i < ENCODED_NO ; i++)
+		recv_temp[i] = 0;
+	    
+	    MPI_Irecv(buffer, ENCODED_NO, MPI_UNSIGNED_LONG, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &req);
+	    
+	    MPI_Test(&req, &flag, &status);
+	    int times = 0;
+	    while(!flag && times < 10) {
+		times++;
+		sleep(1);
+		MPI_Test(&req, &flag, &status);
+	    }
+	    if(!flag)
+		break;
+	    
+	    if (status.MPI_TAG == RESPONSE_TAG) { 
+		for(i = 0 ; i < ENCODED_NO ; i++) {
+		    recv_m[i] += recv_temp[i];
+		}
+		printf("Response received \n"); 
+
+	    } else if (status.MPI_TAG == QUERY_TAG) { 
+		query = (query_payload *)buffer;
+		node_value *value = hmap_get(nodes_map, query); 
+		if (value != NULL) { 
+		    MPI_Send(value->location, NAMEMAX, MPI_CHAR, status.MPI_SOURCE, QUERY_TAG, MPI_COMM_WORLD); 
+		} else {
+		    MPI_Send(&null_location, 1, MPI_CHAR, status.MPI_SOURCE, QUERY_TAG, MPI_COMM_WORLD); 
+		}
+	    }
+	}
+
+	// write results
+	write_result(argv[3]);
+	free(poz);
+
+	free_hmap(nodes_map); 
+    }
+
+    // slaves receive indexes, do computation
+    else {
+
+	locations = mk_hmap(loc_hash, loc_eq); 
+	nodes_cache = mk_hmap(node_hash, node_eq); 
+	while(1) {
+	    
+	    // receive until there's nothing left
+	    MPI_Irecv(recv, 2, MPI_UNSIGNED_LONG, 0, JOB_TAG, MPI_COMM_WORLD, &req);
+	    
+	    MPI_Test(&req, &flag, &status);
+	    int times = 0;
+	    while(!flag && times < 10) {
+		times++;
+		sleep(1);
+		MPI_Test(&req, &flag, &status);
+	    }
+	    if(!flag)
+		break;
+
+	    // read file and do computation
+	    FILE *f;
+
+	    f = fopen(argv[1], "rt");
+	    if (f == NULL) {
+		fprintf(stderr, "Could not open file.\n");
+		MPI_Abort(MPI_COMM_WORLD, 7777);
+	    }
+	    
+	    fseek (f, recv[0], SEEK_SET);
+
+	    // go to the end of the line
+	    char * line = NULL;
+	    size_t len = 0;
+	    ssize_t read;
+	    unsigned long count = 0;
+
+	    for(i = 0 ; i < ENCODED_NO ; i++) {
+		send_m[i] = 0;
+		recv_m[i] = 0;
+	    }
+
+	    while ((read = getline(&line, &len, f)) != -1) {
+
+		// skip the comment line and the half lines
+		count++;
+		if(count == 1)
+		    continue;
+
+		// compute
+		//char response;
+
+		node_key node; 
+		char delims[] = " ";
+		char *result = NULL;
+		result = strtok( line, delims );
+		int token_no = 0;
+		while( result != NULL ) {
+		    token_no++;
+		    if(token_no == 2) {
+			node.node_id = atoi(result);
+		    }
+		    if(token_no == 3) {
+			node.platform_id = atof(result);
+		    }
+		    result = strtok( NULL, delims );
+		}
+		
+		node_value *value = hmap_get(nodes_cache, &node); 
+		
+		if (value == NULL) { 
+		    char location[NAMEMAX]; 
+		    MPI_Send(&node, sizeof(node_key), MPI_CHAR, 0, QUERY_TAG, MPI_COMM_WORLD); 
+		    MPI_Recv(location, NAMEMAX, MPI_CHAR, 0, QUERY_TAG, MPI_COMM_WORLD, &status); 
+		    value = malloc(sizeof(node_value) * strlen(location) + 1); 
+		    node_key *new_node = malloc(sizeof(node_key)); 
+		    new_node->node_id = node.node_id; 
+		    new_node->platform_id = node.platform_id; 
+		    strcpy(value->location, location); 
+		    hmap_add(nodes_cache, new_node, value); 
+		    if (strlen(location) > 0) { 
+			/* add to the locations set */
+			loc_key *loc = malloc(sizeof(loc_key)); 
+			loc->name = value->location; 
+			loc_value *locval = malloc(sizeof(loc_value)); 
+			locval->failures = 1; 
+			hmap_add(locations, loc, locval); 
+			printf("Location is %s \n", location); 
+		    }
+		} else {
+		    printf("Found in local cache %s \n", value->location); 
+		    if (strlen(value->location) > 0) { 
+			loc_key *loc = malloc(sizeof(loc_key)); 
+			loc->name = value->location; 
+			loc_value *loc_data = hmap_get(locations, loc); 
+			if (loc_data != NULL) {
+			    loc_data->failures++; 
+			}
+		    }
+		}
+		// finished reading the chunk?
+		if(ftell(f) > recv[1])
+		    break;
+		
+	    }
+
+	    // send result to master
+	    MPI_Isend(send_m, ENCODED_NO, MPI_UNSIGNED_LONG, 0, RESPONSE_TAG, MPI_COMM_WORLD, &req);
+	}
+    }
+
+    // block and finish
+    MPI_Barrier(MPI_COMM_WORLD);
+
+    
+    MPI_Finalize();
+    return 0; 
+    } 
+
Index: /proiecte/PDAD/trunk/nodeslocation/mpi/readme
===================================================================
--- /proiecte/PDAD/trunk/nodeslocation/mpi/readme	(revision 154)
+++ /proiecte/PDAD/trunk/nodeslocation/mpi/readme	(revision 154)
@@ -0,0 +1,5 @@
+Run:
+mpiexec -n nr_procS ./nodesLocation path_to_event_trace.tab path_to_node.tab output_file
+
+e.g.
+mpiexec -n 2 ./nodesLocation $PP_TESTS_DIR/seti/event_trace.tab $PP_TESTS_DIR/seti/node.tab output_seti
Index: /proiecte/PDAD/trunk/nodeslocation/pig/local/Concat.java
===================================================================
--- /proiecte/PDAD/trunk/nodeslocation/pig/local/Concat.java	(revision 154)
+++ /proiecte/PDAD/trunk/nodeslocation/pig/local/Concat.java	(revision 154)
@@ -0,0 +1,52 @@
+import java.io.IOException;
+import java.util.*;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataBag;
+import org.apache.pig.data.DefaultBagFactory;
+import org.apache.pig.data.DefaultTupleFactory;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.apache.pig.data.DataType;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+
+public class Concat extends EvalFunc<DataBag> {
+	
+    @Override
+    public DataBag exec(Tuple input) throws IOException {
+    	
+	if (input == null || input.size() == 0)
+            return null;
+        try{
+
+        	if(input.get(0) != null && input.get(1) != null) {
+	        	String token1 = input.get(0).toString();
+	        	StringTokenizer st1 = new StringTokenizer(token1);
+	        	String nodeId = st1.nextToken();
+	        	
+	        	String token2 = input.get(1).toString();
+				StringTokenizer st2 = new StringTokenizer(token2);
+				String platformId = st2.nextToken();
+				
+				
+	        	DataBag output = DefaultBagFactory.getInstance().newDefaultBag();
+				Tuple t = DefaultTupleFactory.getInstance().newTuple(1);
+				String label = nodeId + ";" + platformId;
+				t.set(0, label);
+					
+	            output.add(t);
+	            return output;
+        	}
+        	
+        	return null;
+            
+        }catch(Exception e){
+            System.err.println("RealLabelsr: failed to process input; error - " + e.getMessage());
+            e.printStackTrace();
+            return null;
+        }
+
+
+    }
+}
Index: /proiecte/PDAD/trunk/nodeslocation/pig/local/jar.sh
===================================================================
--- /proiecte/PDAD/trunk/nodeslocation/pig/local/jar.sh	(revision 154)
+++ /proiecte/PDAD/trunk/nodeslocation/pig/local/jar.sh	(revision 154)
@@ -0,0 +1,6 @@
+#! /bin/sh
+
+mkdir locationconcat
+javac -classpath $PIGDIR/pig.jar -d locationconcat Concat.java
+jar -cvf locationconcat.jar -C locationconcat/ .
+rm -r locationconcat
Index: /proiecte/PDAD/trunk/nodeslocation/pig/local/nodeslocation.pig
===================================================================
--- /proiecte/PDAD/trunk/nodeslocation/pig/local/nodeslocation.pig	(revision 154)
+++ /proiecte/PDAD/trunk/nodeslocation/pig/local/nodeslocation.pig	(revision 154)
@@ -0,0 +1,21 @@
+-- This script processes number of faults per geographical location.
+
+-- author: cristina
+
+REGISTER locationconcat.jar;
+
+raw_event = LOAD '$inputDir/event_trace.tab' USING PigStorage('\t') AS (event_id,component_id,node_id:int,platform_id:int,node_name,event_type,event_start_time,event_stop_time,event_end_reason:chararray);
+raw_node = LOAD '/home/cristina/PPproj/repo/tests/node.tab' USING PigStorage('\t') AS (node_id:int,platform_id:int,node_name,node_ip,node_location,timezone,proc_model,os_name,cores_per_proc,num_procs,mem_size,disk_size, up_bw,down_bw,metric_id,notes);
+
+-- build durations
+event = FOREACH raw_event GENERATE Concat(node_id,platform_id) as id, 1 as value;
+node = FOREACH raw_node GENERATE Concat(node_id,platform_id) as id, node_location as location;
+--event = FOREACH raw_event GENERATE node_id as id, 1 as value;
+--node = FOREACH raw_node GENERATE node_id as id, node_location as location;
+joined = JOIN event by id, node by id;
+filtered = FOREACH joined GENERATE location, value;
+grouped = GROUP filtered by location;
+rez =  FOREACH grouped GENERATE group, SUM(filtered.value);
+
+STORE rez INTO 'nodeslocation.rez' USING PigStorage();
+
Index: /proiecte/PDAD/trunk/nodeslocation/pig/local/run.sh
===================================================================
--- /proiecte/PDAD/trunk/nodeslocation/pig/local/run.sh	(revision 154)
+++ /proiecte/PDAD/trunk/nodeslocation/pig/local/run.sh	(revision 154)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+rm nodeslocation.rez
+java -cp $PIGDIR/pig.jar org.apache.pig.Main -x local -param inputDir=$PP_TESTS_DIR nodeslocation.pig
+vim nodeslocation.rez 
+
Index: /proiecte/PDAD/trunk/nodeslocation/pig/mr/Concat.java
===================================================================
--- /proiecte/PDAD/trunk/nodeslocation/pig/mr/Concat.java	(revision 154)
+++ /proiecte/PDAD/trunk/nodeslocation/pig/mr/Concat.java	(revision 154)
@@ -0,0 +1,52 @@
+import java.io.IOException;
+import java.util.*;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataBag;
+import org.apache.pig.data.DefaultBagFactory;
+import org.apache.pig.data.DefaultTupleFactory;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.apache.pig.data.DataType;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+
+public class Concat extends EvalFunc<DataBag> {
+	
+    @Override
+    public DataBag exec(Tuple input) throws IOException {
+    	
+	if (input == null || input.size() == 0)
+            return null;
+        try{
+
+        	if(input.get(0) != null && input.get(1) != null) {
+	        	String token1 = input.get(0).toString();
+	        	StringTokenizer st1 = new StringTokenizer(token1);
+	        	String nodeId = st1.nextToken();
+	        	
+	        	String token2 = input.get(1).toString();
+				StringTokenizer st2 = new StringTokenizer(token2);
+				String platformId = st2.nextToken();
+				
+				
+	        	DataBag output = DefaultBagFactory.getInstance().newDefaultBag();
+				Tuple t = DefaultTupleFactory.getInstance().newTuple(1);
+				String label = nodeId + ";" + platformId;
+				t.set(0, label);
+					
+	            output.add(t);
+	            return output;
+        	}
+        	
+        	return null;
+            
+        }catch(Exception e){
+            System.err.println("RealLabelsr: failed to process input; error - " + e.getMessage());
+            e.printStackTrace();
+            return null;
+        }
+
+
+    }
+}
Index: /proiecte/PDAD/trunk/nodeslocation/pig/mr/jar.sh
===================================================================
--- /proiecte/PDAD/trunk/nodeslocation/pig/mr/jar.sh	(revision 154)
+++ /proiecte/PDAD/trunk/nodeslocation/pig/mr/jar.sh	(revision 154)
@@ -0,0 +1,6 @@
+#! /bin/sh
+
+mkdir locationconcat
+javac -classpath $PIG_CLASSPATH -d locationconcat Concat.java
+jar -cvf locationconcat.jar -C locationconcat/ .
+rm -r locationconcat
Index: /proiecte/PDAD/trunk/nodeslocation/pig/mr/nodeslocation.pig
===================================================================
--- /proiecte/PDAD/trunk/nodeslocation/pig/mr/nodeslocation.pig	(revision 154)
+++ /proiecte/PDAD/trunk/nodeslocation/pig/mr/nodeslocation.pig	(revision 154)
@@ -0,0 +1,21 @@
+-- This script processes number of faults per geographical location.
+
+-- author: cristina
+
+REGISTER locationconcat.jar;
+
+raw_event = LOAD '$inputDir1/event_trace.tab' USING PigStorage('\t') AS (event_id,component_id,node_id:int,platform_id:int,node_name,event_type,event_start_time,event_stop_time,event_end_reason:chararray);
+raw_node = LOAD '$inputDir2/node.tab' USING PigStorage('\t') AS (node_id:int,platform_id:int,node_name,node_ip,node_location,timezone,proc_model,os_name,cores_per_proc,num_procs,mem_size,disk_size, up_bw,down_bw,metric_id,notes);
+
+-- build durations
+event = FOREACH raw_event GENERATE flatten(Concat(node_id,platform_id)) as id, 1 as value;
+node = FOREACH raw_node GENERATE flatten(Concat(node_id,platform_id)) as id, node_location as location;
+--event = FOREACH raw_event GENERATE node_id as id, 1 as value;
+--node = FOREACH raw_node GENERATE node_id as id, node_location as location;
+joined = JOIN event by (chararray)id, node by (chararray)id;
+filtered = FOREACH joined GENERATE location, value;
+grouped = GROUP filtered by (chararray)location;
+rez =  FOREACH grouped GENERATE group, SUM(filtered.value);
+
+STORE rez INTO '$outputDir' USING PigStorage();
+
Index: /proiecte/PDAD/trunk/nodeslocation/pig/mr/run.sh
===================================================================
--- /proiecte/PDAD/trunk/nodeslocation/pig/mr/run.sh	(revision 154)
+++ /proiecte/PDAD/trunk/nodeslocation/pig/mr/run.sh	(revision 154)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+$HADOOP_HOME/bin/hadoop fs -rmr output/nodeslocation/pig/$1
+java -cp $PIG_CLASSPATH org.apache.pig.Main -param inputDir1=/user/hadoop/input/$1/event_trace -param inputDir2=/user/hadoop/input/$1/node -param outputDir=output/nodeslocation/pig/$1 nodeslocation.pig
+$HADOOP_HOME/bin/hadoop fs -cat output/nodeslocation/pig/$1/part-00000
+
Index: /proiecte/PDAD/trunk/readme
===================================================================
--- /proiecte/PDAD/trunk/readme	(revision 154)
+++ /proiecte/PDAD/trunk/readme	(revision 154)
@@ -0,0 +1,23 @@
+The following environment variables are required: HADOOP_HOME, PIGDIR, PP_TESTS_DIR.
+
+Eg:
+export HADOOP_HOME=/usr/hadoop-0.20.1
+export PIGDIR=/home/cristina/pig
+export PP_TESTS_DIR=/home/cristina/PPproj/repo/tests
+
+Running tests supposes the following data sets from INRIA Failure Trace Archive are already coppied on HDFS: LANL, Grid'5000, Microsoft, SETI@home.
+The script copy.sh can be used to do this operation, provided that it has the datasets in PP_TESTS_DIR.
+
+To run MapReduce tests:
+./jar_cristina.sh
+./run_all.sh
+
+To run Pig tests:
+./jar_pig_cristina.sh
+./run_pig_all.sh
+
+To run MPI:
+- cd failureCause/mpi
+- follow readme instructions
+
+
Index: /proiecte/PDAD/trunk/run_all.sh
===================================================================
--- /proiecte/PDAD/trunk/run_all.sh	(revision 154)
+++ /proiecte/PDAD/trunk/run_all.sh	(revision 154)
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+echo '--------------------------------------'
+echo 'Running LANL'
+echo '--------------------------------------'
+./run_cristina.sh lanl05_tab_union
+
+echo '--------------------------------------'
+echo 'Running Grid5000'
+echo '--------------------------------------'
+./run_cristina.sh g5k06_tab
+
+echo '--------------------------------------'
+echo 'Running Microsoft'
+echo '--------------------------------------'
+./run_cristina.sh microsoft99_tab
+
+echo '--------------------------------------'
+echo 'Running SETI'
+echo '--------------------------------------'
+./run_cristina.sh seti09_tab
+
+
+
Index: /proiecte/PDAD/trunk/run_cristina.sh
===================================================================
--- /proiecte/PDAD/trunk/run_cristina.sh	(revision 154)
+++ /proiecte/PDAD/trunk/run_cristina.sh	(revision 154)
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+cd failurecause/mapreduce
+./run.sh $1
+cd ../../mediumevents_s/mapreduce
+./run.sh $1
+cd ../../mediumevents/mapreduce
+./run.sh $1
+cd ../../nodeslocation/mapreduce
+./run.sh $1
+
+
+cd ../../endreason
+make -i run APP="$1"
+cd ../endreasonstat
+make -i run APP="$1"
+cd ../comptype
+make -i run APP="$1"
+
+
+
Index: /proiecte/PDAD/trunk/run_pig_all.sh
===================================================================
--- /proiecte/PDAD/trunk/run_pig_all.sh	(revision 154)
+++ /proiecte/PDAD/trunk/run_pig_all.sh	(revision 154)
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+echo '--------------------------------------'
+echo 'Running LANL'
+echo '--------------------------------------'
+./run_pig_cristina.sh lanl05_tab_union
+
+echo '--------------------------------------'
+echo 'Running Grid5000'
+echo '--------------------------------------'
+./run_pig_cristina.sh g5k06_tab
+
+echo '--------------------------------------'
+echo 'Running Microsoft'
+echo '--------------------------------------'
+./run_pig_cristina.sh microsoft99_tab
+
+echo '--------------------------------------'
+echo 'Running SETI'
+echo '--------------------------------------'
+./run_pig_cristina.sh seti09_tab
Index: /proiecte/PDAD/trunk/run_pig_cristina.sh
===================================================================
--- /proiecte/PDAD/trunk/run_pig_cristina.sh	(revision 154)
+++ /proiecte/PDAD/trunk/run_pig_cristina.sh	(revision 154)
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+cd failurecause/pig/mr
+./run.sh $1
+cd ../../../mediumevents/pig/mr
+./run.sh $1
+cd ../../../nodeslocation/pig/mr
+./run.sh $1
+cd ../../../endreason/pig
+./run.sh $1
+
