summaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorKumar Damani <kumar.damani@mail.utoronto.ca>2018-11-21 23:27:49 +0000
committerKumar Damani <kumar.damani@mail.utoronto.ca>2018-11-21 23:27:49 +0000
commitff0e28fbdfe8fd9f8fbaa9559834fee8f4dbcecc (patch)
tree740e1fee55a6629e65af4993d340df0aa8c513d6 /code
parent09af1849763528d2d66f51025755d848ceb6b7e9 (diff)
all remaining files
Diffstat (limited to 'code')
-rw-r--r--code/perflow/.RDatabin0 -> 786614 bytes
-rw-r--r--code/perflow/.Rhistory31
-rw-r--r--code/perflow/flow_duration.R21
-rw-r--r--code/perflow/flow_size.R21
-rw-r--r--code/perflow/flow_size_bytes.R21
-rw-r--r--code/perpacket/.RDatabin0 -> 2322 bytes
-rw-r--r--code/perpacket/.Rhistory3
-rw-r--r--code/perpacket/packet_length_cdf.R31
8 files changed, 128 insertions, 0 deletions
diff --git a/code/perflow/.RData b/code/perflow/.RData
new file mode 100644
index 0000000..3265833
--- /dev/null
+++ b/code/perflow/.RData
Binary files differ
diff --git a/code/perflow/.Rhistory b/code/perflow/.Rhistory
new file mode 100644
index 0000000..5b3199e
--- /dev/null
+++ b/code/perflow/.Rhistory
@@ -0,0 +1,31 @@
+source("flow_duration.R")
+quit()
+source("flow_duration.R")
+quit()
+source("flow_duration.R")
+source("flow_duration.R")
+all_cdf
+quit()
+source("flow_duration.R")
+source("flow_duration.R")
+source("flow_duration.R")
+source("flow_size.R")
+source("flow_size.R")
+options(scipen = 999)
+plot(all_cdf, col="red", main="CDF of flow size of ALL, TCP, UDP flows", xlab="counts", ylab="probability")
+plot(log(all_cdf), col="red", main="CDF of flow size of ALL, TCP, UDP flows", xlab="counts", ylab="probability")
+all_cdf
+all_cdf = ecdf(log(all_counts))
+plot(all_cdf, col="red", main="CDF of flow size of ALL, TCP, UDP flows", xlab="counts", ylab="probability")
+quit()
+source("flow_size.R")
+source("flow_size.R")
+y
+data_tcp
+data_tcp$Bytes
+quit()
+source("flow_size_bytes.R")
+source("flow_size_bytes.R")
+quit()
+source("flow_size_bytes.R")
+quit()
diff --git a/code/perflow/flow_duration.R b/code/perflow/flow_duration.R
new file mode 100644
index 0000000..4176ada
--- /dev/null
+++ b/code/perflow/flow_duration.R
@@ -0,0 +1,21 @@
+data_tcp = read.csv(file="../../data/perflow/flow_tcp.csv", header=TRUE, sep=",")
+data_udp = read.csv(file="../../data/perflow/flow_udp.csv", header=TRUE, sep=",")
+data_other= read.csv(file="../../data/perflow/flow_other.csv", header=TRUE, sep=",")
+
+tcp_durs = data_tcp$Duration
+udp_durs = data_udp$Duration
+other_durs = data_other$Duration
+all_durs = c(tcp_durs, udp_durs, other_durs)
+
+all_cdf = ecdf(all_durs)
+tcp_cdf = ecdf(tcp_durs)
+udp_cdf = ecdf(udp_durs)
+
+#plot(all_cdf, col="red", type="S", main="CDF of flow duration of ALL, TCP, UDP flows", xlab="duration (s)", ylab="probability")
+plot(all_cdf, col="red", main="CDF of flow duration of ALL, TCP, UDP flows", xlab="duration (s)", ylab="probability")
+lines(tcp_cdf, col="blue")
+lines(udp_cdf, col="green")
+legend(200,0.2, legend=c("All", "TCP", "UDP"), col=c("red", "blue", "green"), lty=1)
+dev.print(png, '../../plots/perflow/flowdur_all.png', width=500)
+
+quit()
diff --git a/code/perflow/flow_size.R b/code/perflow/flow_size.R
new file mode 100644
index 0000000..783b8a7
--- /dev/null
+++ b/code/perflow/flow_size.R
@@ -0,0 +1,21 @@
+data_tcp = read.csv(file="../../data/perflow/flow_tcp.csv", header=TRUE, sep=",")
+data_udp = read.csv(file="../../data/perflow/flow_udp.csv", header=TRUE, sep=",")
+data_other= read.csv(file="../../data/perflow/flow_other.csv", header=TRUE, sep=",")
+
+tcp_counts = data_tcp$Packets
+udp_counts = data_udp$Packets
+other_counts = data_other$Packets
+all_counts = c(tcp_counts, udp_counts, other_counts)
+
+all_cdf = ecdf(log(all_counts))
+tcp_cdf = ecdf(log(tcp_counts))
+udp_cdf = ecdf(log(udp_counts))
+
+#plot(all_cdf, col="red", type="S", main="CDF of flow duration of ALL, TCP, UDP flows", xlab="duration (s)", ylab="probability")
+plot(all_cdf, col="red", main="CDF of packet counts of ALL, TCP, UDP flows", xlab="log_10 counts", ylab="probability")
+lines(tcp_cdf, col="blue")
+lines(udp_cdf, col="green")
+legend(8,0.2, legend=c("All", "TCP", "UDP"), col=c("red", "blue", "green"), lty=1)
+dev.print(png, '../../plots/perflow/flowsize_all.png', width=500)
+
+quit()
diff --git a/code/perflow/flow_size_bytes.R b/code/perflow/flow_size_bytes.R
new file mode 100644
index 0000000..f31d711
--- /dev/null
+++ b/code/perflow/flow_size_bytes.R
@@ -0,0 +1,21 @@
+data_tcp = read.csv(file="../../data/perflow/flow_tcp.csv", header=TRUE, sep=",")
+data_udp = read.csv(file="../../data/perflow/flow_udp.csv", header=TRUE, sep=",")
+data_other= read.csv(file="../../data/perflow/flow_other.csv", header=TRUE, sep=",")
+
+tcp_bytes = data_tcp$Bytes
+udp_bytes = data_udp$Bytes
+other_bytes = data_other$Bytes
+all_bytes = c(tcp_counts, udp_counts, other_counts)
+
+all_cdf = ecdf(log(all_counts))
+tcp_cdf = ecdf(log(tcp_counts))
+udp_cdf = ecdf(log(udp_counts))
+
+#plot(all_cdf, col="red", type="S", main="CDF of flow duration of ALL, TCP, UDP flows", xlab="duration (s)", ylab="probability")
+plot(all_cdf, col="red", main="CDF of byte counts of ALL, TCP, UDP flows", xlab="log byte counts", ylab="probability")
+lines(tcp_cdf, col="blue")
+lines(udp_cdf, col="green")
+legend(8,0.2, legend=c("All", "TCP", "UDP"), col=c("red", "blue", "green"), lty=1)
+dev.print(png, '../../plots/perflow/flowsize_all_bytes.png', width=500)
+
+#quit()
diff --git a/code/perpacket/.RData b/code/perpacket/.RData
new file mode 100644
index 0000000..5c32f8b
--- /dev/null
+++ b/code/perpacket/.RData
Binary files differ
diff --git a/code/perpacket/.Rhistory b/code/perpacket/.Rhistory
new file mode 100644
index 0000000..ac5399e
--- /dev/null
+++ b/code/perpacket/.Rhistory
@@ -0,0 +1,3 @@
+source("packet_length_cdf.R")
+source("packet_length_cdf.R")
+source("packet_length_cdf.R")
diff --git a/code/perpacket/packet_length_cdf.R b/code/perpacket/packet_length_cdf.R
new file mode 100644
index 0000000..24bf486
--- /dev/null
+++ b/code/perpacket/packet_length_cdf.R
@@ -0,0 +1,31 @@
+data_all= read.csv(file="../../data/perpacket/packet_lengths_all.csv", header=TRUE, sep=",")
+data_ip = read.csv(file="../../data/perpacket/packet_lengths_ip.csv", header=TRUE, sep=",")
+data_tcp = read.csv(file="../../data/perpacket/packet_lengths_tcp.csv", header=TRUE, sep=",")
+data_udp = read.csv(file="../../data/perpacket/packet_lengths_udp.csv", header=TRUE, sep=",")
+data_nonip = read.csv(file="../../data/perpacket/packet_lengths_nonip.csv", header=TRUE, sep=",")
+
+all_counts = data_all$Count[-1]
+ip_counts = data_ip$Count[-1]
+tcp_counts = data_tcp$Count[-1]
+udp_counts = data_udp$Count[-1]
+nonip_counts = data_nonip$Count[-1]
+
+all_probs = cumsum(all_counts)/data_all$Count[1]
+ip_probs = cumsum(ip_counts)/data_ip$Count[1]
+tcp_probs = cumsum(tcp_counts)/data_tcp$Count[1]
+udp_probs = cumsum(udp_counts)/data_udp$Count[1]
+udp_probs = cumsum(udp_counts)/data_udp$Count[1]
+nonip_probs = cumsum(nonip_counts)/data_nonip$Count[1]
+
+lengths = c(0,20,40,80,160,320,640,1280,2560,5120)
+log_lengths = log(lengths,2)
+
+plot(log_lengths, all_probs, col="red", type="S", main="CDF of packet lengths of ALL, IP, TCP, UDP, and NON-IP packets", xlab="log_2 packet lengths", ylab="probability")
+lines(log_lengths, ip_probs, col="blue", type="S")
+lines(log_lengths, tcp_probs, col="green", type="S")
+lines(log_lengths, udp_probs, col="cyan", type="S")
+lines(log_lengths, nonip_probs, col="pink", type="S")
+legend(10,0.2, legend=c("All","IP", "TCP", "UDP", "Non-IP"), col=c("red", "blue", "green", "cyan", "pink"), lty=1)
+dev.print(png, '../../plots/perpacket/packetsize_all.png', width=500)
+
+quit()