From 47994b66619872336519079846e845b313e948b0 Mon Sep 17 00:00:00 2001
From: Fabian Mastenbroek <mail.fabianm@gmail.com>
Date: Mon, 26 Mar 2018 00:47:14 +0200
Subject: feat: Add job metrics

---
 database/schema.sql | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

(limited to 'database/schema.sql')

diff --git a/database/schema.sql b/database/schema.sql
index 36db1e17..f6286260 100644
--- a/database/schema.sql
+++ b/database/schema.sql
@@ -239,8 +239,8 @@ CREATE TABLE stage_measurements (
   experiment_id INTEGER                 NOT NULL,
   tick          INTEGER                 NOT NULL CHECK (tick >= 0),
   stage         INTEGER                 NOT NULL CHECK (stage >= 0),
-  cpu           INTEGER                 NOT NULL CHECK (cpu >= 0),
-  wall          INTEGER                 NOT NULL CHECK (wall >= 0),
+  cpu           BIGINT                  NOT NULL CHECK (cpu >= 0),
+  wall          BIGINT                  NOT NULL CHECK (wall >= 0),
   size          INTEGER                 NOT NULL CHECK (size >= 0),
   iterations    INTEGER                 NOT NULL CHECK (iterations >= 0),
 
@@ -249,6 +249,26 @@ CREATE TABLE stage_measurements (
     ON UPDATE CASCADE
 );
 
+-- Metrics of a job task
+DROP TABLE IF EXISTS job_metrics;
+CREATE TABLE job_metrics (
+  id                   INTEGER PRIMARY KEY     NOT NULL AUTO_INCREMENT,
+  experiment_id        INTEGER                 NOT NULL,
+  job_id               INTEGER                 NOT NULL,
+  critical_path        INTEGER                 NOT NULL CHECK (critical_path >= 0),
+  critical_path_length INTEGER                 NOT NULL CHECK (critical_path_length >= 0),
+  waiting_time         INTEGER                 NOT NULL CHECK (waiting_time >= 0),
+  makespan             INTEGER                 NOT NULL CHECK (makespan >= 0),
+  nsl                  INTEGER                 NOT NULL CHECK (nsl >= 0),
+
+  FOREIGN KEY (experiment_id) REFERENCES experiments (id)
+    ON DELETE CASCADE
+    ON UPDATE CASCADE,
+  FOREIGN KEY (job_id) REFERENCES jobs (id)
+    ON DELETE CASCADE
+    ON UPDATE CASCADE
+);
+
 -- Metrics of a single task
 DROP TABLE IF EXISTS task_metrics;
 CREATE TABLE task_metrics (
-- 
cgit v1.2.3

