Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
shinpei committed Oct 31, 2011
1 parent 994c1fd commit ede72a0
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 1 deletion.
25 changes: 25 additions & 0 deletions shinpei/faults/et2011/apache_search.k
@@ -0,0 +1,25 @@
using konoha.proc.*;

void apache_search() {
p = new Proc(["/bin/pidof", "apache2"]);
ins = p.getInputStream();
while (p.isAlive()) {
str = ins.readLine();
OUT << str << EOL;
if (|str| > 0) {
pids = str.split(" ");
foreach (String spid in pids) {
procinfo = new ProcInfo((int)spid);
if (procinfo.states["PPid"] == "1") {
String procfilename = "/proc/" + spid + "/oom_adj";
OUT << procfilename << EOL;
ous = new OutputStream(file:: procfilename);
ous.write((Bytes)"15");
ous.close();
}
}
}
}
OUT << "done... " << EOL;
}

37 changes: 37 additions & 0 deletions shinpei/faults/et2011/kick.k
@@ -0,0 +1,37 @@
using konoha.actor.*;

int main(String[] args)
{
a1 = actor:192.168.0.5:50010;
ins = new InputStream("proc.k");
buf = "";
foreach (String line in ins) {
if (line == "") continue;
buf = buf + line + EOL;
}
a1.eval(buf);
//OUT << buf << EOL;

ins = new InputStream("apache_search.k");
buf = "";
foreach (String line in ins) {
if (line == "") continue;
buf = buf + line + EOL;
}
a1.eval(buf);
//OUT << buf << EOL;
a1.eval("apache_search();");


a2 = actor:192.168.0.5:50011;
ins = new InputStream("memstress.k");
buf = "";
foreach (String line in ins) {
if (line == "") continue;
buf = buf + line + EOL;
}
a2.eval(buf);
OUT << buf << EOL;
a2.eval("invoke_memstress();");
return 0;
}
6 changes: 6 additions & 0 deletions shinpei/faults/et2011/memstress.k
@@ -0,0 +1,6 @@
using konoha.proc.*;

void invoke_memstress() {
p = new Proc(["/home/tsunade/fault/memstress-1.0.0/memstress", "102400", "17000", "50"]);
OUT << p.isAlive() << EOL;
}
19 changes: 19 additions & 0 deletions shinpei/faults/et2011/proc.k
@@ -0,0 +1,19 @@

class ProcInfo {
int mypid;
Map states;
ProcInfo(int pid) {
states = {};
mypid = pid;
procfilename = "/proc/" + (String)pid + "/status";
ins = new InputStream(file:: procfilename);
foreach (String line in ins) {
m = line.split(":");
key = m[0].trim();
value = m[1].trim();
states[key] = value;
}
}
}


21 changes: 20 additions & 1 deletion shinpei/xmlparser/bpmn2.k
Expand Up @@ -77,6 +77,8 @@ class Association extends ConnectionObject {
//class Group extends BPMN2Object;
//class Annotation extends BPMN2Object;

// alternative class of BPMNFlow

class BPMNWorkflow {
@Private Event startEvent;
@Private Event endEvent;
Expand All @@ -89,17 +91,31 @@ class BPMNWorkflow {
FlowObject seekPointer;

BPMNWorkflow () {
startEvent = null;
endevent = null;
flowobjects = [];
connobjects = [];
flowNum = 0;
connNum = 0;
seekPointer = startEvent;
}

@Public void setupStartEvent(Event ev) {
startEvent = ev;
}

@Public void setupEndEvent (Event ev) {
endEvent = ev;
}

@Public Event fetchStartEvent () {
return startEvent;
}

@Public Event fetchEndEvent () {
return endEvent;
}

@Public void addFlow (FlowObject fo) {
flowobjects.add(fo);
flowNum++;
Expand Down Expand Up @@ -131,9 +147,12 @@ class CodeGenerator {
String generate (BPMNWorkflow workflow) {
String code = '';
if (workflow.flowNum == 0 || workflow.connNum == 0) return "";

Activity[] act = workflow.flowObject;
// task parse
Map <String, Activity> activity_map = {};
foreach (Activity act in workflow.flowObjects) {
activity_map[act["id"]] = act;
}
return code;
}
}
Expand Down

0 comments on commit ede72a0

Please sign in to comment.