From 1bf65ae6ebe56c0d742acedcc4f326ff15f6a0ad Mon Sep 17 00:00:00 2001 From: Christian Wulf <chw@informatik.uni-kiel.de> Date: Wed, 30 Nov 2016 13:36:28 +0100 Subject: [PATCH] refactored r script --- ...me-of-chunks-of-calls-30-November-2016.pdf | Bin 44097 -> 44097 bytes bin/r/response-time-of-chunks-of-calls.r | 14 +++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/r/response-time-of-chunks-of-calls-30-November-2016.pdf b/bin/r/response-time-of-chunks-of-calls-30-November-2016.pdf index 16cab1f8f5cbe33e77fd7810f40b984dd56f6d6b..6d8ea58185a845b72f6bf0dfeeeafdf236815d07 100644 GIT binary patch delta 25 dcmX?jgX!Q6rU}+8#zrQF6YV9y^v39Cs{wjv2_pai delta 25 dcmX?jgX!Q6rU}+8hK8o*6YV9y^v39Cs{wkU2`c~q diff --git a/bin/r/response-time-of-chunks-of-calls.r b/bin/r/response-time-of-chunks-of-calls.r index 331bd7a..5db2c21 100644 --- a/bin/r/response-time-of-chunks-of-calls.r +++ b/bin/r/response-time-of-chunks-of-calls.r @@ -7,14 +7,17 @@ numFirstValuesToIgnore = 10000000 chunkSize = 10000 colors = c("red", "blue", "green", "black") -yVerticals = c(NA, 2, NA, 2) # returns a data.table (by default) ## which enhances/extends a data.frame ### which in turn is a list of vectors. #### Each vector in the list represents a row with its column values. csvTable = fread(filename, skip=numFirstValuesToIgnore) -# csvTable with an additional column "id" which contains the row numbers + +rowCount = csvTable[, .N] +cat(sprintf("\nYour input file contains %d lines.\n\n", rowCount)) + +# csvTable with an additional column "id" which contains the row numbers (necessary for grouping; see below) csvTable[, id:=1:.N] print(csvTable) @@ -22,13 +25,14 @@ print(csvTable) # default column name: "V" followed by the column number thread <- csvTable[["V1"]] time <- csvTable[["V2"]] -# groupedTime is a table with "id" and "V1" +memory <- csvTable[["V3"]] +gcActivity <- csvTable[["V4"]] + +# grouped*Time is a table with "id" and "V1" groupedMaxTime <- csvTable[, max(V2), by=.((id-1)%/%chunkSize)] groupedMeanTime <- csvTable[, mean(V2), by=.((id-1)%/%chunkSize)] groupedMedianTime <- csvTable[, median(V2), by=.((id-1)%/%chunkSize)] groupedMinTime <- csvTable[, min(V2), by=.((id-1)%/%chunkSize)] -memory <- csvTable[["V3"]] -gcActivity <- csvTable[["V4"]] maxTimes <- groupedMaxTime[["V1"]] meanTimes <- groupedMeanTime[["V1"]] -- GitLab