--- /dev/null
+-initializerandom -injectinstructionfailures 45 0.0001667 10 -debugtask
task Message(ChatSocket cs{InRoom && IOPending}) {
byte buffer[]=new byte[1024];
int length=cs.read(buffer);
- String st=(new String(buffer)).subString(0, length);
- Message m=new Message(st, cs){};
+ Message m=new Message(buffer, length, cs){};
}
task SendMessage(Message m{!Sent}) {
- m.cs.room.sendToRoom(m.cs,m.st.getBytes());
+ String st=(new String(m.buffer)).subString(0, m.length);
+ m.cs.room.sendToRoom(m.cs,st.getBytes());
taskexit(m {Sent});
}
--- /dev/null
+import java.io.*;
+public class analyze {
+ public static void main(String[] q) {
+ int sum=0;
+ int count=0;
+ try {
+ BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
+ while(true) {
+ String s=br.readLine();
+ String x=s.substring(6,s.indexOf(' ',6));
+
+ sum+=(new Integer(x)).intValue();
+ count++;
+ System.out.println(sum+" "+(((double)sum)/count));
+ }
+ } catch(Exception e) {}
+ }
+
+
+
+}
--- /dev/null
+#!/bin/bash
+./runtest.sh taskchat.bin &> tasklog
+mkdir task
+mv *.log task
+./runtest.sh threadchat.bin &> threadlog
+mkdir thread
+mv *.log thread
\ No newline at end of file
--- /dev/null
+#!/bin/bash
+let i=0
+while [ $i -le 100 ];
+do
+./$1 &> $i.log &
+sleep 1
+java NetsClient 127.0.0.1 8000 2 50 8 1
+killall -SIGUSR2 $1
+sleep 1
+killall -9 $1
+let "i+=1"
+done
\ No newline at end of file