From fe2a1dcdc34c78f1dafa3cbaabcc87a219edcee8 Mon Sep 17 00:00:00 2001 From: SimoneDutto Date: Sat, 5 Sep 2020 11:50:08 +0200 Subject: [PATCH] Add code to simualte fault --- ML/eval_proc.py | 15 +++++++++++---- ML/model_NN50_20.pth | Bin 22223 -> 0 bytes cmd/monitor | 3 +-- cmd/prova.c | 26 ++++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 6 deletions(-) delete mode 100644 ML/model_NN50_20.pth create mode 100644 cmd/prova.c diff --git a/ML/eval_proc.py b/ML/eval_proc.py index 10fbe00..c859e66 100644 --- a/ML/eval_proc.py +++ b/ML/eval_proc.py @@ -5,6 +5,8 @@ import sys import torch.nn as nn import numpy as np +from sklearn.preprocessing import StandardScaler + PATH= "/home/sgundo/Desktop/Tesi/OS_FaultMonitor/ML/" len_index = 20 @@ -34,18 +36,21 @@ def forward(self, x): def eval(feat): X = np.array(feat) + X= scaler.transform(X) X = torch.from_numpy(X).float() X = X.unsqueeze(0) y = model(X) y = torch.log_softmax(y, dim=1) _, y = torch.max(y, dim = 1) - return y.item() f_s = True # read metrics from file or receive it from socket flip = 0 cmd = sys.argv[1] bi = sys.argv[2] +scaler = StandardScaler() # standard scaler as in the train set +# scaler.mean_ = +# scaler.var_ = model = BinaryClassification() model.load_state_dict(torch.load(PATH+bi+".pth", map_location=torch.device('cpu'))) model.eval() @@ -59,13 +64,15 @@ def eval(feat): first_line = file.readline() for last_line in file: pass - print (last_line) + #print (last_line) attr = last_line.split() attr = attr[3:] - print(attr) + #print(attr) attr_int = [int(i) for i in attr] if len(attr_int) == 7: - eval(attr_int) + #response = eval(attr_int) + response = 1 + print("Evaluation: "+str(response)) else: with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: diff --git a/ML/model_NN50_20.pth b/ML/model_NN50_20.pth deleted file mode 100644 index 15d381f6d6db1bf1546ff8d4fadc4d4b3cd118e8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 22223 zcmZs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ciato $cmd" - conf="instr_retired,unhalted_ref_cycles_fixed,cycles,instr,llc_references,llc_misses,branch_instr_retired" -nohup pmctrack -T 1 -c $conf $cmd > $cmd.out +pmctrack -o $cmd.out -T 1 -c $conf $cmd python3 /home/sgundo/Desktop/Tesi/OS_FaultMonitor/ML/eval_proc.py $cmd $target # pid=$! # echo $pid diff --git a/cmd/prova.c b/cmd/prova.c new file mode 100644 index 0000000..c8d8eed --- /dev/null +++ b/cmd/prova.c @@ -0,0 +1,26 @@ +#include +#include +#include +#include + +/* +Simple program to simulate a fault with a 50% chance +*/ + +int main(int argc, char* argv[]){ + int i = 0; + int *ptr1, *ptr2=NULL; + for(i=0;i<10000000;i++); + + srand(time(0)); + ptr1 = &i; + //printf("Pointer value before %p\n", ptr1); + ptr2 = (int *) ((uintptr_t) ptr1 | (uintptr_t) 0xFFF000); //simulate a fault by changing a pointer + //printf("Pointer value after %p\n", ptr2); + if((rand()%2)==0) + i = *ptr2; + else + i = *ptr1; + + //printf("Intero %d\n", i); +}