summaryrefslogtreecommitdiff
path: root/results/src/experiment3/__main__.py
blob: 7a7d95197215b5c42b87023afb7cbef8f227c472 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import pandas as pd
import time
import csv
import os
from time import gmtime, strftime
import numpy as np
import matplotlib.pyplot as plt

CONSTANT = 3_6000_000 / 24

# Largest to smallest failure traces:
# Facebook (112115 failures), Twitter (64128 failures), Youtube (56286) Whatsapp (19769), Gmail (14622)
# Threshold is everywhere 218


def get_name() -> str:

    curr = time.time()
    s = strftime("%d_%b_%Y_%H%M%S", gmtime(curr))
    return s


def iterate(frame):
    red_alarms = 0
    yellow_alarms = 0
    for i, row in frame.iterrows():
        s = row["alarm"]
        if s == "red":
            red_alarms = red_alarms + 1
        if s == "yellow":
            yellow_alarms = yellow_alarms + 1
    return (yellow_alarms, red_alarms)


def main():

    df = pd.read_csv("NoColumn.txt")
    print(df)
    result = iterate(df)
    print(result)


if __name__ == "__main__":
    main()