Validators for load tests, and load test scripts.
This commit is contained in:
parent
2cec1f7836
commit
482da790ea
18 changed files with 2222 additions and 11 deletions
233
scripts/capa_service.cpp
Executable file
233
scripts/capa_service.cpp
Executable file
|
@ -0,0 +1,233 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
#include <iostream>
|
||||
#include <mist/json.h>
|
||||
#include <mist/timing.h>
|
||||
|
||||
///\brief A class storing information about the cpu the server is running on.
|
||||
class cpudata{
|
||||
public:
|
||||
std::string model;///<A string describing the model of the cpu.
|
||||
int cores;///<The amount of cores in the cpu.
|
||||
int threads;///<The amount of threads this cpu can run.
|
||||
int mhz;///<The speed of the cpu in mhz.
|
||||
int id;///<The id of the cpu in the system.
|
||||
|
||||
///\brief The default constructor
|
||||
cpudata(){
|
||||
model = "Unknown";
|
||||
cores = 1;
|
||||
threads = 1;
|
||||
mhz = 0;
|
||||
id = 0;
|
||||
}
|
||||
;
|
||||
|
||||
///\brief Fills the structure by parsing a given description.
|
||||
///\param data A description of the cpu.
|
||||
void fill(char * data){
|
||||
int i;
|
||||
i = 0;
|
||||
if (sscanf(data, "model name : %n", &i) != EOF && i > 0){
|
||||
model = (data + i);
|
||||
}
|
||||
if (sscanf(data, "cpu cores : %d", &i) == 1){
|
||||
cores = i;
|
||||
}
|
||||
if (sscanf(data, "siblings : %d", &i) == 1){
|
||||
threads = i;
|
||||
}
|
||||
if (sscanf(data, "physical id : %d", &i) == 1){
|
||||
id = i;
|
||||
}
|
||||
if (sscanf(data, "cpu MHz : %d", &i) == 1){
|
||||
mhz = i;
|
||||
}
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
///\brief Checks the capabilities of the system.
|
||||
///\param capa The location to store the capabilities.
|
||||
void checkCapable(JSON::Value & capa){
|
||||
//capa.null();
|
||||
capa.removeMember("cpu");
|
||||
std::ifstream cpuinfo("/proc/cpuinfo");
|
||||
if (cpuinfo){
|
||||
std::map<int, cpudata> cpus;
|
||||
char line[300];
|
||||
int proccount = -1;
|
||||
while (cpuinfo.good()){
|
||||
cpuinfo.getline(line, 300);
|
||||
if (cpuinfo.fail()){
|
||||
//empty lines? ignore them, clear flags, continue
|
||||
if ( !cpuinfo.eof()){
|
||||
cpuinfo.ignore();
|
||||
cpuinfo.clear();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (memcmp(line, "processor", 9) == 0){
|
||||
proccount++;
|
||||
}
|
||||
cpus[proccount].fill(line);
|
||||
}
|
||||
//fix wrong core counts
|
||||
std::map<int, int> corecounts;
|
||||
for (int i = 0; i <= proccount; ++i){
|
||||
corecounts[cpus[i].id]++;
|
||||
}
|
||||
//remove double physical IDs - we only want real CPUs.
|
||||
std::set<int> used_physids;
|
||||
int total_speed = 0;
|
||||
int total_threads = 0;
|
||||
for (int i = 0; i <= proccount; ++i){
|
||||
if ( !used_physids.count(cpus[i].id)){
|
||||
used_physids.insert(cpus[i].id);
|
||||
JSON::Value thiscpu;
|
||||
thiscpu["model"] = cpus[i].model;
|
||||
thiscpu["cores"] = cpus[i].cores;
|
||||
if (cpus[i].cores < 2 && corecounts[cpus[i].id] > cpus[i].cores){
|
||||
thiscpu["cores"] = corecounts[cpus[i].id];
|
||||
}
|
||||
thiscpu["threads"] = cpus[i].threads;
|
||||
if (thiscpu["cores"].asInt() > thiscpu["threads"].asInt()){
|
||||
thiscpu["threads"] = thiscpu["cores"];
|
||||
}
|
||||
thiscpu["mhz"] = cpus[i].mhz;
|
||||
capa["cpu"].append(thiscpu);
|
||||
total_speed += cpus[i].cores * cpus[i].mhz;
|
||||
total_threads += cpus[i].threads;
|
||||
}
|
||||
}
|
||||
capa["speed"] = total_speed;
|
||||
capa["threads"] = total_threads;
|
||||
}
|
||||
std::ifstream cpuUsage("/proc/stat");
|
||||
if (cpuUsage){
|
||||
char line[300];
|
||||
cpuUsage.getline(line, 300);
|
||||
long long int i, o, p, q;
|
||||
if (sscanf(line, "cpu %lli %lli %lli %lli ", &i, &o, &p, &q) == 4){
|
||||
capa["usage"]["user"] = i;
|
||||
capa["usage"]["nice"] = o;
|
||||
capa["usage"]["system"] = p;
|
||||
capa["usage"]["idle"] = q;
|
||||
}else{
|
||||
std::cerr << "HALP!" << std::endl;
|
||||
}
|
||||
}
|
||||
std::ifstream meminfo("/proc/meminfo");
|
||||
if (meminfo){
|
||||
char line[300];
|
||||
int bufcache = 0;
|
||||
while (meminfo.good()){
|
||||
meminfo.getline(line, 300);
|
||||
if (meminfo.fail()){
|
||||
//empty lines? ignore them, clear flags, continue
|
||||
if ( !meminfo.eof()){
|
||||
meminfo.ignore();
|
||||
meminfo.clear();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
long long int i;
|
||||
if (sscanf(line, "MemTotal : %lli kB", &i) == 1){
|
||||
capa["mem"]["total"] = i;
|
||||
}
|
||||
if (sscanf(line, "MemFree : %lli kB", &i) == 1){
|
||||
capa["mem"]["free"] = i;
|
||||
}
|
||||
if (sscanf(line, "SwapTotal : %lli kB", &i) == 1){
|
||||
capa["mem"]["swaptotal"] = i;
|
||||
}
|
||||
if (sscanf(line, "SwapFree : %lli kB", &i) == 1){
|
||||
capa["mem"]["swapfree"] = i;
|
||||
}
|
||||
if (sscanf(line, "Buffers : %lli kB", &i) == 1){
|
||||
bufcache += i;
|
||||
}
|
||||
if (sscanf(line, "Cached : %lli kB", &i) == 1){
|
||||
bufcache += i;
|
||||
}
|
||||
}
|
||||
capa["mem"]["used"] = capa["mem"]["total"].asInt() - capa["mem"]["free"].asInt() - bufcache;
|
||||
capa["mem"]["cached"] = bufcache;
|
||||
capa["load"]["memory"] = ((capa["mem"]["used"].asInt() + (capa["mem"]["swaptotal"].asInt() - capa["mem"]["swapfree"].asInt())) * 100) / capa["mem"]["total"].asInt();
|
||||
}
|
||||
std::ifstream loadavg("/proc/loadavg");
|
||||
if (loadavg){
|
||||
char line[300];
|
||||
loadavg.getline(line, 300);
|
||||
//parse lines here
|
||||
float onemin;
|
||||
if (sscanf(line, "%f %*f %*f", &onemin) == 1){
|
||||
capa["load"]["one"] = (long long int)(onemin*1000);
|
||||
}
|
||||
}
|
||||
std::ifstream netUsage("/proc/net/dev");
|
||||
capa["net"]["sent"] = 0;
|
||||
capa["net"]["recv"] = 0;
|
||||
while (netUsage){
|
||||
char line[300];
|
||||
netUsage.getline(line, 300);
|
||||
long long unsigned sent = 0;
|
||||
long long unsigned recv = 0;
|
||||
//std::cout << line;
|
||||
if (sscanf(line, "%*s %llu %*u %*u %*u %*u %*u %*u %*u %llu", &recv, &sent) == 2){
|
||||
//std::cout << "Net: " << recv << ", " << sent << std::endl;
|
||||
capa["net"]["recv"] = (long long int)(capa["net"]["recv"].asInt() + recv);
|
||||
capa["net"]["sent"] = (long long int)(capa["net"]["sent"].asInt() + sent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv){
|
||||
JSON::Value stats;
|
||||
checkCapable(stats);
|
||||
std::ofstream file(argv[1]);
|
||||
file << "Time in seconds,1m load average,Memory use in bytes,CPU percentage,Uploaded bytes,Downloaded bytes" << std::endl;
|
||||
long long int totalCpu = 0;
|
||||
long long int grandTotal = 0;
|
||||
long long int usrCpu = 0;
|
||||
long long int niceCpu = 0;
|
||||
long long int systemCpu = 0;
|
||||
long long int prevUsrCpu = stats["usage"]["user"].asInt();
|
||||
long long int prevNiceCpu = stats["usage"]["nice"].asInt();
|
||||
long long int prevSystemCpu = stats["usage"]["system"].asInt();
|
||||
long long int prevIdleCpu = stats["usage"]["idle"].asInt();
|
||||
long long int startUpload = stats["net"]["sent"].asInt();
|
||||
long long int startDownload = stats["net"]["recv"].asInt();
|
||||
long long int startTime = Util::epoch();
|
||||
long long int lastTime = 0;
|
||||
while (true){
|
||||
Util::sleep(500);//faster than once per second, just in case we go out of sync somewhere
|
||||
if (lastTime == Util::epoch()){
|
||||
continue;//if a second hasn't passed yet, skip this run
|
||||
}
|
||||
lastTime = Util::epoch();
|
||||
checkCapable(stats);
|
||||
file << (lastTime - startTime) << ",";//time since start
|
||||
file << (double)stats["load"]["one"].asInt()/1000.0 << ","; //LoadAvg
|
||||
file << stats["mem"]["used"].asString() << ","; //MemUse
|
||||
|
||||
usrCpu = stats["usage"]["user"].asInt() - prevUsrCpu;
|
||||
niceCpu = stats["usage"]["nice"].asInt() - prevNiceCpu;
|
||||
systemCpu = stats["usage"]["system"].asInt() - prevSystemCpu;
|
||||
totalCpu = usrCpu + niceCpu + systemCpu;
|
||||
grandTotal = totalCpu + stats["usage"]["idle"].asInt() - prevIdleCpu;
|
||||
if (grandTotal != 0){
|
||||
file << 100 * (double)totalCpu / grandTotal << ",";//totalCpu
|
||||
}else{
|
||||
file << "," << std::endl;//unknown CPU usage
|
||||
}
|
||||
file << (stats["net"]["sent"].asInt() - startUpload) << "," << (stats["net"]["recv"].asInt() - startDownload) << std::endl;
|
||||
prevUsrCpu = stats["usage"]["user"].asInt();
|
||||
prevNiceCpu = stats["usage"]["nice"].asInt();
|
||||
prevSystemCpu = stats["usage"]["system"].asInt();
|
||||
prevIdleCpu = stats["usage"]["idle"].asInt();
|
||||
}
|
||||
return 0;
|
||||
}
|
53
scripts/crashTests
Executable file
53
scripts/crashTests
Executable file
|
@ -0,0 +1,53 @@
|
|||
#!/bin/bash
|
||||
|
||||
#Q3 2014 style
|
||||
#BATCHES="-b \"1 1\" -b \"1 300\" -b \"1 600\" -b \"1 1200\""
|
||||
#TIMES="-t 60 -t 600"
|
||||
#SERVCONF="-s krabs -l /home/thulinma/capa_service/ -fresh"
|
||||
|
||||
#Q2 2014 style
|
||||
#BATCHES="-b \"1 1\" -b \"1 100\" -b \"1 1000\" -b \"1 1200\""
|
||||
#TIMES="-t 60 -t 180 -t 600"
|
||||
#SERVCONF="-s krabs -l /home/thulinma/capa_service/ -fresh"
|
||||
|
||||
#Q1 2014 style
|
||||
#BATCHES="-b \"2 50\" -b \"4 50\" -b \"8 50\" -b \"16 50\" -b \"24 50\""
|
||||
#TIMES="-t 60 -t 300 -t 600"
|
||||
#SERVCONF="-s krabs -l /home/thulinma/capa_service/ -fresh"
|
||||
|
||||
#single run
|
||||
BATCHES="-b \"1 42\""
|
||||
TIMES="-t 60"
|
||||
#BATCHES="-b \"1 1000\" -b \"1 5000\" -b \"1 10000\""
|
||||
#TIMES="-t 5"
|
||||
SERVCONF="-s krabs -l /home/thulinma/capa_service/"
|
||||
|
||||
#empty the run-script
|
||||
rm scriptje.sh
|
||||
touch scriptje.sh
|
||||
|
||||
#DASH
|
||||
#echo "./loadTest $SERVCONF -p wowza4 $BATCHES $TIMES -m http://krabs:1935/vod/_definst_/mp4:example1_low.mp4/manifest_mvtime_w1216364513.mpd" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p mistserver $BATCHES $TIMES -m http://krabs:8080/dash/example1_low/index.mpd" >> scriptje.sh
|
||||
|
||||
#HLS
|
||||
#echo "./loadTest $SERVCONF -p wowza4 $BATCHES $TIMES -m http://krabs:1935/vod/mp4:example1_low.mp4/playlist.m3u8" >> scriptje.sh
|
||||
echo "./loadTest $SERVCONF -p mistserver $BATCHES $TIMES -m http://krabs:8080/hls/example1_low/index.m3u8" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p flussonic $BATCHES $TIMES -m http://krabs/vod/example1_low.mp4/tracks-1,2/index.m3u8" >> scriptje.sh
|
||||
|
||||
#RTMP
|
||||
#echo "./loadTest $SERVCONF -p wowza4 $BATCHES $TIMES -m rtmp://krabs/vod/mp4:example1_low.mp4" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p nginx $BATCHES $TIMES -m rtmp://krabs/vod2/example1_low.mp4" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p adobe $BATCHES $TIMES -m rtmp://krabs/vod/mp4:tests/example1_low.flv" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p mistserver $BATCHES $TIMES -m rtmp://krabs/a/example1_low" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p flussonic $BATCHES $TIMES -m rtmp://krabs/vod/example1_low.mp4.mp4" >> scriptje.sh
|
||||
|
||||
#FLV
|
||||
#echo "./loadTest $SERVCONF -p mistserver $BATCHES $TIMES -m http://krabs:8080/example1_low.flv" >> scriptje.sh
|
||||
|
||||
|
||||
#run it
|
||||
. scriptje.sh
|
||||
|
||||
~/yup
|
||||
|
56
scripts/genericTests
Executable file
56
scripts/genericTests
Executable file
|
@ -0,0 +1,56 @@
|
|||
#!/bin/bash
|
||||
|
||||
#Q3 2014 style
|
||||
#BATCHES="-b \"1 1\" -b \"1 300\" -b \"1 600\" -b \"1 1200\""
|
||||
#TIMES="-t 60 -t 600"
|
||||
#SERVCONF="-s krabs -l /home/thulinma/capa_service/ -fresh"
|
||||
|
||||
#Q2 2014 style
|
||||
#BATCHES="-b \"1 1\" -b \"1 100\" -b \"1 1000\" -b \"1 1200\""
|
||||
#TIMES="-t 60 -t 180 -t 600"
|
||||
#SERVCONF="-s krabs -l /home/thulinma/capa_service/ -fresh"
|
||||
|
||||
#Q1 2014 style
|
||||
#BATCHES="-b \"2 50\" -b \"4 50\" -b \"8 50\" -b \"16 50\" -b \"24 50\""
|
||||
#TIMES="-t 60 -t 300 -t 600"
|
||||
#SERVCONF="-s krabs -l /home/thulinma/capa_service/ -fresh"
|
||||
|
||||
#single run
|
||||
#BATCHES="-b \"1 1200\""
|
||||
BATCHES="-b \"600 1\""
|
||||
TIMES="-t 10"
|
||||
#BATCHES="-b \"1 1000\" -b \"1 5000\" -b \"1 10000\""
|
||||
#TIMES="-t 5"
|
||||
SERVCONF="-s krabs -l /home/thulinma/capa_service/"
|
||||
|
||||
#empty the run-script
|
||||
rm scriptje.sh
|
||||
touch scriptje.sh
|
||||
|
||||
#DASH
|
||||
#echo "./loadTest $SERVCONF -p wowza4 $BATCHES $TIMES -m http://krabs:1935/vod/_definst_/mp4:example1_low.mp4/manifest_mvtime_w1216364513.mpd" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p mistserver $BATCHES $TIMES -m http://krabs:8080/dash/example1_low/index.mpd" >> scriptje.sh
|
||||
|
||||
#HLS
|
||||
#echo "./loadTest $SERVCONF -p wowza4 $BATCHES $TIMES -m http://krabs:1935/vod/mp4:example1_low.mp4/playlist.m3u8" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p mistserver $BATCHES $TIMES -m http://krabs:8080/hls/example1_low/index.m3u8" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p flussonic $BATCHES $TIMES -m http://krabs/vod/example1_low.mp4/tracks-1,2/index.m3u8" >> scriptje.sh
|
||||
|
||||
#RTMP
|
||||
#echo "./loadTest $SERVCONF -p wowza4 $BATCHES $TIMES -m rtmp://krabs/vod/mp4:example1_low.mp4" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p nginx $BATCHES $TIMES -m rtmp://krabs/vod2/example1_low.mp4" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p adobe $BATCHES $TIMES -m rtmp://krabs/vod/mp4:tests/example1_low.flv" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p mistserver $BATCHES $TIMES -m rtmp://krabs/a/example1_low" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p flussonic $BATCHES $TIMES -m rtmp://krabs/vod/example1_low.mp4.mp4" >> scriptje.sh
|
||||
|
||||
#FLV
|
||||
echo "./loadTest $SERVCONF -p mistserver $BATCHES $TIMES -m http://krabs:8080/example1_low.flv" >> scriptje.sh
|
||||
|
||||
#MP4
|
||||
#echo "./loadTest $SERVCONF -p mistserver $BATCHES $TIMES -m http://krabs:8080/example1_low.mp4" >> scriptje.sh
|
||||
|
||||
#run it
|
||||
. scriptje.sh
|
||||
|
||||
~/yup
|
||||
|
58
scripts/genericTestsSimple
Executable file
58
scripts/genericTestsSimple
Executable file
|
@ -0,0 +1,58 @@
|
|||
#!/bin/bash
|
||||
|
||||
#Q3 2014 style
|
||||
#BATCHES="-b \"1 1\" -b \"1 300\" -b \"1 600\" -b \"1 1200\""
|
||||
#TIMES="-t 60 -t 600"
|
||||
#SERVCONF="-s krabs -l /home/thulinma/capa_service/ -fresh"
|
||||
|
||||
#Q2 2014 style
|
||||
#BATCHES="-b \"1 1\" -b \"1 100\" -b \"1 1000\" -b \"1 1200\""
|
||||
#TIMES="-t 60 -t 180 -t 600"
|
||||
#SERVCONF="-s krabs -l /home/thulinma/capa_service/ -fresh"
|
||||
|
||||
#Q1 2014 style
|
||||
#BATCHES="-b \"2 50\" -b \"4 50\" -b \"8 50\" -b \"16 50\" -b \"24 50\""
|
||||
#TIMES="-t 60 -t 300 -t 600"
|
||||
#SERVCONF="-s krabs -l /home/thulinma/capa_service/ -fresh"
|
||||
|
||||
#single run
|
||||
#BATCHES="-b \"1 127\""
|
||||
#TIMES="-t 30"
|
||||
|
||||
|
||||
|
||||
BATCHES="-b \"1 50\" -b \"1 100\" -b \"1 150\" -b \"1 200\" -b \"1 250\" -b \"1 300\" -b \"1 350\""
|
||||
TIMES="-t 30"
|
||||
|
||||
#BATCHES="-b \"1 1000\" -b \"1 5000\" -b \"1 10000\""
|
||||
#TIMES="-t 5"
|
||||
|
||||
#empty the run-script
|
||||
rm scriptje.sh
|
||||
touch scriptje.sh
|
||||
|
||||
#DASH
|
||||
#echo "./loadTest $SERVCONF -p wowza4 $BATCHES $TIMES -m http://krabs:1935/vod/_definst_/mp4:example1_low.mp4/manifest_mvtime_w1216364513.mpd" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p mistserver $BATCHES $TIMES -m http://krabs:8080/dash/example1_low/index.mpd" >> scriptje.sh
|
||||
|
||||
#HLS
|
||||
#echo "./loadTest $SERVCONF -p wowza4 $BATCHES $TIMES -m http://krabs:1935/vod/mp4:example1_low.mp4/playlist.m3u8" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p mistserver $BATCHES $TIMES -m http://krabs:8080/hls/example1_low/index.m3u8" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p flussonic $BATCHES $TIMES -m http://krabs/vod/example1_low.mp4/tracks-1,2/index.m3u8" >> scriptje.sh
|
||||
|
||||
#RTMP
|
||||
#echo "./loadTest $SERVCONF -p wowza4 $BATCHES $TIMES -m rtmp://krabs/vod/mp4:example1_low.mp4" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p nginx $BATCHES $TIMES -m rtmp://krabs/vod2/example1_low.mp4" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p adobe $BATCHES $TIMES -m rtmp://krabs/vod/mp4:tests/example1_low.flv" >> scriptje.sh
|
||||
#echo "./loadTestSimple $BATCHES $TIMES -m rtmp://mistpuma/a/example1_low" >> scriptje.sh
|
||||
echo "./loadTestSimple $BATCHES $TIMES -m http://192.168.137.86:8080/schijtaap.flv" >> scriptje.sh
|
||||
#echo "./loadTestSimple $BATCHES $TIMES -m rtmp://poema/a/b1" >> scriptje.sh
|
||||
#echo "./loadTestSimple $BATCHES $TIMES -m rtmp://poema/a/b2" >> scriptje.sh
|
||||
#echo "./loadTestSimple $BATCHES $TIMES -m rtmp://poema/a/b3" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p flussonic $BATCHES $TIMES -m rtmp://krabs/vod/example1_low.mp4.mp4" >> scriptje.sh
|
||||
|
||||
#run it
|
||||
. scriptje.sh
|
||||
|
||||
~/yup
|
||||
|
32
scripts/genericTests_larry
Executable file
32
scripts/genericTests_larry
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
BATCHES="-b \"1 1\" -b \"1 100\" -b \"1 1000\" -b \"1 1200\""
|
||||
TIMES="-t 60 -t 180 -t 600"
|
||||
|
||||
#BATCHES="-b \"1 500\""
|
||||
#TIMES="-t 30"
|
||||
|
||||
#BATCHES="-b \"16 50\" -b \"24 50\""
|
||||
|
||||
#BATCHES="-b \"10 1\""
|
||||
#TIMES="-t 10 -t 60 -t 180 -t 600"
|
||||
|
||||
SERVCONF="-s krabs -l /home/thulinma/capa_service/ -fresh"
|
||||
#SERVCONF="-s krabs -l /home/thulinma/capa_service/"
|
||||
|
||||
rm scriptje.sh
|
||||
touch scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p mistserver -b \"20 27\" -t 40 -m http://krabs:8080/example1_low.mp4" >> scriptje.sh
|
||||
|
||||
#echo "./loadTest $SERVCONF -p mistserver $BATCHES $TIMES -m http://krabs:8080/example1_low.flv" >> scriptje.sh
|
||||
#echo "./loadTest $SERVCONF -p mistserver $BATCHES $TIMES -m rtmp://krabs/a/example1_low -m http://krabs:8080/example1_low.flv" >> scriptje.sh
|
||||
|
||||
#echo "./loadTest $SERVCONF -p mistserver -b \"16 50\" -t 600 -m rtmp://krabs/a/example1_low" >> scriptje.sh
|
||||
|
||||
echo "./loadTest $SERVCONF -p wowza4 $BATCHES $TIMES -m rtmp://krabs/vod/mp4:example1_low.mp4" >> scriptje.sh
|
||||
echo "./loadTest $SERVCONF -p nginx $BATCHES $TIMES -m rtmp://krabs/vod2/example1_low.mp4" >> scriptje.sh
|
||||
echo "./loadTest $SERVCONF -p adobe $BATCHES $TIMES -m rtmp://krabs/vod/mp4:tests/example1_low.flv" >> scriptje.sh
|
||||
echo "./loadTest $SERVCONF -p mistserver $BATCHES $TIMES -m rtmp://krabs/a/example1_low" >> scriptje.sh
|
||||
|
||||
. scriptje.sh
|
||||
|
20
scripts/install_capa.sh
Executable file
20
scripts/install_capa.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
g++ -lmist -Wall -o capa_service capa_service.cpp
|
||||
if [ $? -eq 0 ]; then
|
||||
bestand=/etc/systemd/system/capa_service.service
|
||||
echo "[Unit]" > $bestand
|
||||
echo "Description=capa_service" >> $bestand
|
||||
echo "After=networkmanager.service" >> $bestand
|
||||
echo "" >> $bestand
|
||||
echo "[Service]" >> $bestand
|
||||
echo "Type=simple" >> $bestand
|
||||
echo "User=$USER" >> $bestand
|
||||
echo "ExecStart="`pwd`"/capa_service" `pwd`/log.csv >> $bestand
|
||||
echo "Restart=always" >> $bestand
|
||||
echo "RestartSec=5" >> $bestand
|
||||
echo "" >> $bestand
|
||||
echo "[Install]" >> $bestand
|
||||
echo "WantedBy=multi-user.target" >> $bestand
|
||||
|
||||
systemctl daemon-reload
|
||||
fi
|
17
scripts/install_mist_service.sh
Executable file
17
scripts/install_mist_service.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
bestand=/etc/systemd/system/mistserver.service
|
||||
echo "[Unit]" > $bestand
|
||||
echo "Description=MistServer" >> $bestand
|
||||
echo "After=networkmanager.service" >> $bestand
|
||||
echo "" >> $bestand
|
||||
echo "[Service]" >> $bestand
|
||||
echo "Type=simple" >> $bestand
|
||||
echo "User=$USER" >> $bestand
|
||||
echo "ExecStart=/usr/bin/MistController -nc "`pwd`"/config.json" >> $bestand
|
||||
echo "Restart=always" >> $bestand
|
||||
echo "RestartSec=5" >> $bestand
|
||||
echo "" >> $bestand
|
||||
echo "[Install]" >> $bestand
|
||||
echo "WantedBy=multi-user.target" >> $bestand
|
||||
|
||||
|
263
scripts/loadTest
Executable file
263
scripts/loadTest
Executable file
|
@ -0,0 +1,263 @@
|
|||
#!/bin/bash
|
||||
|
||||
#starting with define of stream getter functions
|
||||
#for all funcions: $1 = stream, $2 = time to download
|
||||
function genericGetter {
|
||||
echo filesize `curl -s -m $2 $1| wc -c` 1>&2
|
||||
}
|
||||
|
||||
function flvGetter {
|
||||
curl -s -m $2 $1 2> /dev/null | ../MistAnalyserFLV -m validate 2> /dev/null
|
||||
}
|
||||
|
||||
function hlsGetter {
|
||||
../MistAnalyserHLS -m validate -a $2 $1 2>/dev/null
|
||||
}
|
||||
|
||||
function oggGetter {
|
||||
curl -s -m $2 $1 | ../MistAnalyserOGG -m validate
|
||||
}
|
||||
|
||||
function dashGetter {
|
||||
../MistAnalyserDASH -m validate -a $2 $1 2>/dev/null
|
||||
}
|
||||
|
||||
function rtmpGetter {
|
||||
#$rtmpGetter ignores $2, because rtmpdump has no time setting
|
||||
#rtmpdump is ended with killall in parent function
|
||||
rtmpdump -qRr $1 -o - 2> /dev/null | ../MistAnalyserFLV -m validate 2> /dev/null
|
||||
}
|
||||
|
||||
function serverTest {
|
||||
rm /tmp/res*_*
|
||||
#this functions creates a csv file with all statistics during the tests
|
||||
#$1 = number of stream batches
|
||||
#$2 = amount of streams per batch (amount of streams = $! * $2)
|
||||
#$3 = current stream test
|
||||
#$4 = ssh access to server where our log file is located
|
||||
#$5 = duration of test in seconds
|
||||
#$6 = location of log file on server
|
||||
#$7 = getter used for stream testing
|
||||
#$8 = Extra comments added to .csv file
|
||||
#$9 = Output basename
|
||||
echo "Test variables:" > $9.info
|
||||
echo "Start time: `date`" >> $9.info
|
||||
echo "Client count: `echo "$1 * $2" | bc`" >> $9.info
|
||||
echo "Batch Size: $2" >> $9.info
|
||||
echo "Stream URL: $3" >> $9.info
|
||||
echo "Duration: $5 seconds" >> $9.info
|
||||
val="none"
|
||||
logdir="$6"
|
||||
if [ -n "$7" ] ; then
|
||||
echo "Validator: $7" >> $9.info
|
||||
val="$7"
|
||||
fi
|
||||
ssh $4 sudo systemctl restart capa_service
|
||||
#sleeping, so service can properly start
|
||||
sleep 2
|
||||
|
||||
getter="${val}Getter"
|
||||
#starting all tests
|
||||
prefix="res"`date +%s`_
|
||||
for x in `seq 1 1 $1`; do
|
||||
for y in `seq 1 1 $2`; do
|
||||
eval "$getter $3 $5" >& /tmp/$prefix`echo "$x * $2 + $y" | bc`.txt &
|
||||
done
|
||||
sleep 1
|
||||
done
|
||||
|
||||
start=`date +%s`
|
||||
f=$(( `date +%s` - $start ))
|
||||
while [ $f -lt $5 ]; do
|
||||
sleep 2
|
||||
f=$(( `date +%s` - $start ))
|
||||
done
|
||||
if [ "$val" == "rtmp" ] ; then
|
||||
killall rtmpdump
|
||||
fi
|
||||
#wait 20 seconds after terminating
|
||||
start=`date +%s`
|
||||
f=$(( `date +%s` - $start ))
|
||||
while [ $f -lt 20 ]; do
|
||||
sleep 2
|
||||
f=$(( `date +%s` - $start ))
|
||||
done
|
||||
cat /tmp/$prefix* > $9.times
|
||||
ssh $4 sudo systemctl stop capa_service
|
||||
ssh $4 "cat $logdir/log.csv" > $9.csv
|
||||
wait
|
||||
}
|
||||
|
||||
function rebootHost {
|
||||
nowtime=`ssh $1 uptime -s`
|
||||
timeOut=$(( `date +%s` + 3600 ))
|
||||
echo "Rebooting host $1..."
|
||||
ssh $1 sudo shutdown -r 3
|
||||
echo "Waiting for host to come back..."
|
||||
sleep 3
|
||||
while [ true ]; do
|
||||
sleep 5
|
||||
#ping for connection
|
||||
ping -c1 $1 > /dev/null
|
||||
if [ `echo $?` == 0 ]; then
|
||||
#check ssh
|
||||
if [ "`ssh -o 'ConnectTimeout 5' $1 echo DDVtesting`" == "DDVtesting" ]; then
|
||||
#check uptime
|
||||
if [ "`ssh -o 'ConnectTimeout 5' $1 uptime -s`" != "$nowtime" ]; then
|
||||
echo host succesfully rebooted
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ $timeOut -lt `date +%s` ]; then
|
||||
echo timeout
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function checkService {
|
||||
echo "doing runcheck"
|
||||
echo "ssh $1 systemctl status $2 | grep Active\:"
|
||||
status="`ssh $1 systemctl status $2 | grep Active\:`"
|
||||
if [ "${status:11:6}" != "active" ]; then
|
||||
echo starting ${2}...
|
||||
ssh $1 sudo systemctl stop wowza
|
||||
ssh $1 sudo systemctl stop wowza4
|
||||
ssh $1 sudo systemctl stop nginx
|
||||
ssh $1 sudo systemctl stop mistserver
|
||||
ssh $1 sudo systemctl stop adobe
|
||||
ssh $1 sudo systemctl disable wowza
|
||||
ssh $1 sudo systemctl disable wowza4
|
||||
ssh $1 sudo systemctl disable nginx
|
||||
ssh $1 sudo systemctl disable mistserver
|
||||
ssh $1 sudo systemctl disable adobe
|
||||
ssh $1 sudo systemctl enable $2
|
||||
ssh $1 sudo systemctl start $2
|
||||
else
|
||||
echo $2 is running...
|
||||
fi
|
||||
}
|
||||
|
||||
#setting default values
|
||||
server="localhost"
|
||||
comment=""
|
||||
logdir="`pwd`"
|
||||
freshBoot="y"
|
||||
product="mistserver"
|
||||
declare -a timegroup
|
||||
declare -a request
|
||||
declare -a stream
|
||||
|
||||
#parsing arguments
|
||||
red=1
|
||||
while [ $red -le $# ]; do
|
||||
case ${!red} in
|
||||
"-s") #defines server
|
||||
red=$(( $red + 1 ))
|
||||
server=${!red}
|
||||
;;
|
||||
"-l") #defines directory on the server with the capabilities log
|
||||
red=$(( $red + 1 ))
|
||||
logdir=${!red}
|
||||
;;
|
||||
"-t") #defines timelengths for tests
|
||||
red=$(( $red + 1 ))
|
||||
timegroup+=( ${!red} )
|
||||
;;
|
||||
"-b") #defines user batches for tests (must be in format "batchamount batchsize")
|
||||
red=$(( $red + 1 ))
|
||||
request+=( "${!red}" )
|
||||
;;
|
||||
"-c") #add a comment
|
||||
red=$(( $red + 1 ))
|
||||
comment=${!red}
|
||||
;;
|
||||
"-m") #defines a media stream and validator
|
||||
red=$(( $red + 1 ))
|
||||
stream+=( "${!red}" )
|
||||
;;
|
||||
"-p") #defines the product to be tested, default is mistserver
|
||||
red=$(( $red + 1 ))
|
||||
product=${!red}
|
||||
;;
|
||||
"-fresh")
|
||||
freshBoot="x"
|
||||
;;
|
||||
*)
|
||||
comment=`echo $comment ${!red}`
|
||||
esac
|
||||
red=$(( $red + 1 ))
|
||||
done
|
||||
|
||||
#determining validators
|
||||
for (( i=0; i<${#stream[@]}; i++ )) ; do
|
||||
if [ "${stream[$i]:0:4}" == "rtmp" ]; then
|
||||
validator[$i]="rtmp"
|
||||
else
|
||||
tempFile=$(basename "${stream[$i]}")
|
||||
tempExt="${tempFile##*.}"
|
||||
case $tempExt in
|
||||
"flv")
|
||||
validator[$i]="flv"
|
||||
;;
|
||||
"ogg")
|
||||
validator[$i]="ogg"
|
||||
;;
|
||||
"m3u8")
|
||||
validator[$i]="hls"
|
||||
;;
|
||||
"m3u")
|
||||
validator[$i]="hls"
|
||||
;;
|
||||
"mpd")
|
||||
validator[$i]="dash"
|
||||
;;
|
||||
*)
|
||||
validator[$i]="generic"
|
||||
esac
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#request[@]} == 0 ]; then
|
||||
request=( "1 1000" )
|
||||
fi
|
||||
|
||||
if [ ${#timegroup[@]} == 0 ]; then
|
||||
timegroup=( 60 )
|
||||
fi
|
||||
|
||||
#checking if the right product is enabled on the server is
|
||||
checkService $server $product
|
||||
|
||||
#making directory for test
|
||||
temp="$product"`date +%y%m%d%H%M%S`
|
||||
mkdir $temp
|
||||
|
||||
#starting test
|
||||
for (( i=0; i<${#stream[@]}; i++ )) ; do
|
||||
for (( p=0; p<${#timegroup[@]}; p++ )) ; do
|
||||
for (( o=0; o<${#request[@]}; o++ )) ; do
|
||||
if [ $freshBoot == "x" ]; then
|
||||
rebootHost $server
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo lost host in reboot process, exiting...
|
||||
exit $?;
|
||||
fi
|
||||
checkService $server $product
|
||||
fi
|
||||
tnr=` echo "$i * ${#timegroup[@]} * ${#request[@]} + $o * ${#timegroup[@]} + $p" | bc `
|
||||
name=$temp"/run"
|
||||
if [ $tnr -lt 100 ] ; then
|
||||
name="${name}0"
|
||||
fi
|
||||
if [ $tnr -lt 10 ] ; then
|
||||
name="${name}0"
|
||||
fi
|
||||
amount=`echo ${request[$o]} | sed -e 's/ /*/g' | bc`
|
||||
name="${name}${tnr}_${amount}_${validator[$i]}_${timegroup[$p]}"
|
||||
echo "$name ${request[$o]} ${stream[$i]} $server ${timegroup[$p]} ${validator[$i]}"
|
||||
serverTest ${request[$o]} ${stream[$i]} $server ${timegroup[$p]} $logdir ${validator[$i]} "$comment" $name
|
||||
done
|
||||
done
|
||||
done
|
200
scripts/loadTestSimple
Executable file
200
scripts/loadTestSimple
Executable file
|
@ -0,0 +1,200 @@
|
|||
#!/bin/bash
|
||||
|
||||
#starting with define of stream getter functions
|
||||
#for all funcions: $1 = stream, $2 = time to download
|
||||
function genericGetter {
|
||||
echo filesize `curl -s -m $2 $1| wc -c` 1>&2
|
||||
}
|
||||
|
||||
function flvGetter {
|
||||
curl -s -m $2 $1 2> /dev/null | ../MistAnalyserFLV -m validate 2> /dev/null
|
||||
}
|
||||
|
||||
function hlsGetter {
|
||||
../MistAnalyserHLS -m validate -a $2 $1 2>/dev/null
|
||||
}
|
||||
|
||||
function oggGetter {
|
||||
curl -s -m $2 $1 | ../MistAnalyserOGG -m validate
|
||||
}
|
||||
|
||||
function dashGetter {
|
||||
../MistAnalyserDASH -m validate -a $2 $1 2>/dev/null
|
||||
}
|
||||
|
||||
function rtmpGetter {
|
||||
#$rtmpGetter ignores $2, because rtmpdump has no time setting
|
||||
#rtmpdump is ended with killall in parent function
|
||||
rtmpdump -qRr $1 -o - 2> /dev/null | ../MistAnalyserFLV -m validate 2> /dev/null
|
||||
}
|
||||
|
||||
function serverTest {
|
||||
rm /tmp/res*_*
|
||||
#this functions creates a csv file with all statistics during the tests
|
||||
#$1 = number of stream batches
|
||||
#$2 = amount of streams per batch (amount of streams = $! * $2)
|
||||
#$3 = current stream test
|
||||
#$4 = ssh access to server where our log file is located
|
||||
#$5 = duration of test in seconds
|
||||
#$6 = location of log file on server
|
||||
#$7 = getter used for stream testing
|
||||
#$8 = Extra comments added to .csv file
|
||||
#$9 = Output basename
|
||||
echo "Test variables:" > $9.info
|
||||
echo "Start time: `date`" >> $9.info
|
||||
echo "Client count: `echo "$1 * $2" | bc`" >> $9.info
|
||||
echo "Batch Size: $2" >> $9.info
|
||||
echo "Stream URL: $3" >> $9.info
|
||||
echo "Duration: $5 seconds" >> $9.info
|
||||
val="none"
|
||||
logdir="$6"
|
||||
if [ -n "$7" ] ; then
|
||||
echo "Validator: $7" >> $9.info
|
||||
val="$7"
|
||||
fi
|
||||
|
||||
getter="${val}Getter"
|
||||
#starting all tests
|
||||
prefix="res"`date +%s`_
|
||||
for x in `seq 1 1 $1`; do
|
||||
for y in `seq 1 1 $2`; do
|
||||
eval "$getter $3 $5" >& /tmp/$prefix`echo "$x * $2 + $y" | bc`.txt &
|
||||
done
|
||||
sleep 1
|
||||
done
|
||||
|
||||
start=`date +%s`
|
||||
f=$(( `date +%s` - $start ))
|
||||
while [ $f -lt $5 ]; do
|
||||
sleep 2
|
||||
f=$(( `date +%s` - $start ))
|
||||
done
|
||||
if [ "$val" == "rtmp" ] ; then
|
||||
killall rtmpdump
|
||||
fi
|
||||
#wait 20 seconds after terminating
|
||||
start=`date +%s`
|
||||
f=$(( `date +%s` - $start ))
|
||||
while [ $f -lt 20 ]; do
|
||||
sleep 2
|
||||
f=$(( `date +%s` - $start ))
|
||||
done
|
||||
cat /tmp/$prefix* > $9.times
|
||||
wait
|
||||
}
|
||||
|
||||
|
||||
#setting default values
|
||||
server="localhost"
|
||||
comment=""
|
||||
logdir="`pwd`"
|
||||
freshBoot="y"
|
||||
product="mistserver"
|
||||
declare -a timegroup
|
||||
declare -a request
|
||||
declare -a stream
|
||||
|
||||
#parsing arguments
|
||||
red=1
|
||||
while [ $red -le $# ]; do
|
||||
case ${!red} in
|
||||
"-s") #defines server
|
||||
red=$(( $red + 1 ))
|
||||
server=${!red}
|
||||
;;
|
||||
"-l") #defines directory on the server with the capabilities log
|
||||
red=$(( $red + 1 ))
|
||||
logdir=${!red}
|
||||
;;
|
||||
"-t") #defines timelengths for tests
|
||||
red=$(( $red + 1 ))
|
||||
timegroup+=( ${!red} )
|
||||
;;
|
||||
"-b") #defines user batches for tests (must be in format "batchamount batchsize")
|
||||
red=$(( $red + 1 ))
|
||||
request+=( "${!red}" )
|
||||
;;
|
||||
"-c") #add a comment
|
||||
red=$(( $red + 1 ))
|
||||
comment=${!red}
|
||||
;;
|
||||
"-m") #defines a media stream and validator
|
||||
red=$(( $red + 1 ))
|
||||
stream+=( "${!red}" )
|
||||
;;
|
||||
"-p") #defines the product to be tested, default is mistserver
|
||||
red=$(( $red + 1 ))
|
||||
product=${!red}
|
||||
;;
|
||||
"-fresh")
|
||||
freshBoot="x"
|
||||
;;
|
||||
*)
|
||||
comment=`echo $comment ${!red}`
|
||||
esac
|
||||
red=$(( $red + 1 ))
|
||||
done
|
||||
|
||||
#determining validators
|
||||
for (( i=0; i<${#stream[@]}; i++ )) ; do
|
||||
if [ "${stream[$i]:0:4}" == "rtmp" ]; then
|
||||
validator[$i]="rtmp"
|
||||
else
|
||||
tempFile=$(basename "${stream[$i]}")
|
||||
tempExt="${tempFile##*.}"
|
||||
case $tempExt in
|
||||
"flv")
|
||||
validator[$i]="flv"
|
||||
;;
|
||||
"ogg")
|
||||
validator[$i]="ogg"
|
||||
;;
|
||||
"m3u8")
|
||||
validator[$i]="hls"
|
||||
;;
|
||||
"m3u")
|
||||
validator[$i]="hls"
|
||||
;;
|
||||
"mpd")
|
||||
validator[$i]="dash"
|
||||
;;
|
||||
*)
|
||||
validator[$i]="generic"
|
||||
esac
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#request[@]} == 0 ]; then
|
||||
request=( "1 1000" )
|
||||
fi
|
||||
|
||||
if [ ${#timegroup[@]} == 0 ]; then
|
||||
timegroup=( 60 )
|
||||
fi
|
||||
|
||||
#making directory for test
|
||||
temp="$product"`date +%y%m%d%H%M%S`
|
||||
mkdir $temp
|
||||
|
||||
#starting test
|
||||
for (( i=0; i<${#stream[@]}; i++ )) ; do
|
||||
for (( p=0; p<${#timegroup[@]}; p++ )) ; do
|
||||
for (( o=0; o<${#request[@]}; o++ )) ; do
|
||||
tnr=` echo "$i * ${#timegroup[@]} * ${#request[@]} + $o * ${#timegroup[@]} + $p" | bc `
|
||||
name=$temp"/run"
|
||||
if [ $tnr -lt 100 ] ; then
|
||||
name="${name}0"
|
||||
fi
|
||||
if [ $tnr -lt 10 ] ; then
|
||||
name="${name}0"
|
||||
fi
|
||||
amount=`echo ${request[$o]} | sed -e 's/ /*/g' | bc`
|
||||
name="${name}${tnr}_${amount}_${validator[$i]}_${timegroup[$p]}"
|
||||
echo "$name ${request[$o]} ${stream[$i]} $server ${timegroup[$p]} ${validator[$i]}"
|
||||
serverTest ${request[$o]} ${stream[$i]} $server ${timegroup[$p]} $logdir ${validator[$i]} "$comment" $name
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
./plotDieShit $temp
|
||||
|
187
scripts/makeplots
Executable file
187
scripts/makeplots
Executable file
|
@ -0,0 +1,187 @@
|
|||
#!/bin/bash
|
||||
|
||||
MBIT="0.6Mbit stream"
|
||||
T="pngcairo size 1000,600 enhanced font \"LiberationSerif,20\""
|
||||
EXT=png
|
||||
#T="pdfcairo"
|
||||
#EXT=pdf
|
||||
|
||||
function runplot {
|
||||
for R in `seq -w 0 100`; do
|
||||
FLDS=( $1 )
|
||||
NAMS=( $2 )
|
||||
|
||||
FN=`ls ${FLDS[0]}/run${R}_*.csv 2> /dev/null`
|
||||
if [ -z $FN ] ; then
|
||||
return
|
||||
fi
|
||||
FILE=`basename $FN`
|
||||
|
||||
FN=`ls ${FLDS[0]}/run${R}_*.times 2> /dev/null`
|
||||
TIMES=`basename $FN`
|
||||
VIEWERS=`echo $FILE | cut -d '_' -f 2`
|
||||
TECH=`echo $FILE | cut -d '_' -f 3`
|
||||
SECS=`echo $FILE | cut -d '.' -f 1 | cut -d '_' -f 4`
|
||||
TIME=$(( $SECS / 60 ))m
|
||||
|
||||
FILES=()
|
||||
TIME_FN=()
|
||||
|
||||
for i in `seq $(( ${#FLDS[@]} - 1 )) -1 0`; do
|
||||
FN=`ls ${FLDS[$i]}/run${R}_*.csv 2> /dev/null`
|
||||
if [ -z $FN ] ; then
|
||||
return
|
||||
fi
|
||||
FILES[$i]="${FLDS[$i]}/`basename $FN`"
|
||||
FN=`ls ${FLDS[$i]}/run${R}_*.times 2> /dev/null`
|
||||
TIME_FN[$i]="${FLDS[$i]}/`basename $FN`"
|
||||
done
|
||||
|
||||
if [ -n "$3" ] ; then
|
||||
COMMON_DATA="${TIME}, ${MBIT}, ${VIEWERS} $3"
|
||||
CFN="$3_${VIEWERS}_${TIME}"
|
||||
COMMON_FILENAME=${CFN,,}
|
||||
else
|
||||
COMMON_DATA="${TIME}, ${MBIT}, ${VIEWERS} ${TECH}"
|
||||
COMMON_FILENAME="${TECH}_${VIEWERS}_${TIME}"
|
||||
fi
|
||||
|
||||
PLOT1=""
|
||||
PLOT2=""
|
||||
PLOT3=""
|
||||
PLOT4=""
|
||||
PLOT5=""
|
||||
PLOT6=""
|
||||
PLOT7=""
|
||||
for i in `seq $(( ${#FLDS[@]} - 1 )) -1 0`; do
|
||||
if [ -n "${PLOT1}" ] ; then
|
||||
PLOT1="${PLOT1}, "
|
||||
PLOT2="${PLOT2}, "
|
||||
PLOT3="${PLOT3}, "
|
||||
PLOT4="${PLOT4}, "
|
||||
PLOT5="${PLOT5}, "
|
||||
PLOT6="${PLOT6}, "
|
||||
PLOT7="${PLOT7}, "
|
||||
fi
|
||||
sort --field-separator=',' --key=4g < "${TIME_FN[$i]}" > "${TIME_FN[$i]}_sorted"
|
||||
VC=`cut -f 4 -d ',' < "${TIME_FN[$i]}" | awk "(int(\\\$1) >= ${SECS}000-5000) {sum++} END{print sum}"`
|
||||
SC=`cut -f 4 -d ',' < "${TIME_FN[$i]}" | awk "(int(\\\$1) >= ${SECS}000-30000) {sum++} END{print sum}"`
|
||||
|
||||
#smooth CPU and network
|
||||
PLOT6="${PLOT6}'${FILES[$i]}' using 1:4:(1) with lines lw 2 title '${NAMS[$i]} (${VC}, ${SC})' smooth acsplines"
|
||||
PLOT7="${PLOT7}'${FILES[$i]}' using (\$1-dx):(d(\$1,\$5/131072.0)):(1) with lines lw 2 title '${NAMS[$i]} (${VC}, ${SC})' smooth acsplines"
|
||||
|
||||
#actual CPU and network
|
||||
PLOT1="${PLOT1}'${FILES[$i]}' using 1:4 with lines lw 2 title '${NAMS[$i]} (${VC}, ${SC})'"
|
||||
PLOT4="${PLOT4}'${FILES[$i]}' using (\$1-dx):(d(\$1,\$5/131072.0)) with lines lw 2 title '${NAMS[$i]} (${VC}, ${SC})'"
|
||||
|
||||
#memory - no need for smoothing, it's already pretty smooth
|
||||
PLOT2="${PLOT2}'${FILES[$i]}' using 1:(\$3/1024.0) with lines lw 2 title '${NAMS[$i]} (${VC}, ${SC})'"
|
||||
#total upload - same here, no need to smooth anything over
|
||||
PLOT3="${PLOT3}'${FILES[$i]}' using 1:(\$5/134217728.0) with lines lw 2 title '${NAMS[$i]} (${VC}, ${SC})'"
|
||||
#and buffer times. Smoothing makes no sense here. Don't.
|
||||
PLOT5="${PLOT5}'${TIME_FN[$i]}_sorted' using (\$4-${SECS}000)/1000 with linespoints lw 1 title '${NAMS[$i]} (${VC}, ${SC})'"
|
||||
done
|
||||
|
||||
gnuplot << EOF
|
||||
set terminal ${T}
|
||||
set datafile separator ","
|
||||
set key on under center
|
||||
|
||||
#set style fill solid 0.25 border -1
|
||||
#set style boxplot outliers pointtype 7
|
||||
#set style data boxplot
|
||||
#set boxwidth 0.5
|
||||
set pointsize 0.2
|
||||
set arrow from 0,-5 to ${VIEWERS}-1,-5 nohead
|
||||
|
||||
set title "Available buffer time, ${COMMON_DATA} clients"
|
||||
set output '${COMMON_FILENAME}_buffers.${EXT}'
|
||||
set format y "%gs"
|
||||
set ylabel "Buffer size (above line = success)"
|
||||
set xlabel "Each point represents a single connection"
|
||||
unset xtics
|
||||
plot ${PLOT5}
|
||||
unset style
|
||||
unset xlabel
|
||||
unset arrow
|
||||
|
||||
set timefmt "%s"
|
||||
set xtics
|
||||
set xdata time
|
||||
#set xlabel "Time (mm:ss)"
|
||||
set format x "%M:%S"
|
||||
set grid
|
||||
|
||||
set title "CPU usage, ${COMMON_DATA} clients"
|
||||
set output '${COMMON_FILENAME}_cpu.${EXT}'
|
||||
set yrange [0:*<100]
|
||||
set format y "%.0f %%"
|
||||
set ylabel "CPU use"
|
||||
plot ${PLOT1}
|
||||
|
||||
set title "Memory usage, ${COMMON_DATA} clients"
|
||||
set output '${COMMON_FILENAME}_mem.${EXT}'
|
||||
set yrange [0<*<0:0<*]
|
||||
set ytics auto
|
||||
set format y "%g MiB"
|
||||
set ylabel "Memory use"
|
||||
plot ${PLOT2}
|
||||
|
||||
set title "Network upload, ${COMMON_DATA} clients"
|
||||
set output '${COMMON_FILENAME}_upload.${EXT}'
|
||||
set yrange [0<*<0:0<*]
|
||||
set ytics auto
|
||||
set format y "%g Gbit"
|
||||
set ylabel "Total uploaded data"
|
||||
plot ${PLOT3}
|
||||
|
||||
# derivative function. Return 1/0 for first point, otherwise delta y or (delta y)/(delta x)
|
||||
d(x,y) = (\$0 == 1) ? (x1 = x, y1 = y, 1/0) : (x2 = x1, x1 = x, y2 = y1, y1 = y, (y1-y2)/(x1-x2))
|
||||
|
||||
set title "Network speed, ${COMMON_DATA} clients"
|
||||
set output '${COMMON_FILENAME}_netspeed.${EXT}'
|
||||
set yrange [0<*<0:0<*]
|
||||
set ytics auto
|
||||
set format y "%g Mbps"
|
||||
set ylabel "Upload speed"
|
||||
dx=0.5
|
||||
plot ${PLOT4}
|
||||
|
||||
set title "Smoothed CPU usage, ${COMMON_DATA} clients"
|
||||
set output '${COMMON_FILENAME}_cpu_smooth.${EXT}'
|
||||
set yrange [0:*<100]
|
||||
set format y "%.0f %%"
|
||||
set ylabel "CPU use"
|
||||
plot ${PLOT6}
|
||||
|
||||
set title "Smoothed network speed, ${COMMON_DATA} clients"
|
||||
set output '${COMMON_FILENAME}_netspeed_smooth.${EXT}'
|
||||
set yrange [0<*<0:0<*]
|
||||
set ytics auto
|
||||
set format y "%g Mbps"
|
||||
set ylabel "Upload speed"
|
||||
dx=0.5
|
||||
plot ${PLOT7}
|
||||
|
||||
EOF
|
||||
|
||||
for i in `seq $(( ${#FLDS[@]} - 1 )) -1 0`; do
|
||||
rm -f "${FLDS[$i]}/${TIMES}_sorted"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
#runplot "adobe_rtmp nginx_rtmp wowza_rtmp mist_rtmp flus_rtmp" "Adobe Nginx Wowza MistServer Flussonic"
|
||||
#runplot "wowza_hls flus_hls mist_hls" "Wowza Flussonic MistServer"
|
||||
#runplot "wowza_dash mist_dash" "Wowza MistServer"
|
||||
|
||||
#runplot "wowza_rtmp wowza_hls wowza_dash" "RTMP HLS DASH" "Wowza"
|
||||
#runplot "mist_rtmp mist_hls mist_dash" "RTMP HLS DASH" "MistServer"
|
||||
runplot "mistserver*" "test" "RTMP"
|
||||
|
||||
#runplot "wowza_dash mist_dash wowza_dash_new mist_dash_new mist_dash3" "Wowza Mist WowNew MistNew MistNewer"
|
||||
#runplot "mist_dash mist_dash_new mist_dash3" "Old New Newer" "MistDash"
|
||||
#runplot "wowza_hls_new flus_hls_new mist_hls_new mist_hls5" "Wowza Flus Mist MistNew"
|
||||
#runplot "adobe_rtmp nginx_rtmp wowza_rtmp mist_rtmp flus_rtmp mist_rtmp5" "Adobe Nginx Wowza MistServer Flussonic MistNew"
|
||||
|
101
scripts/plotDieShit
Executable file
101
scripts/plotDieShit
Executable file
|
@ -0,0 +1,101 @@
|
|||
#!/bin/bash
|
||||
FOLDER=$1
|
||||
SPEED=$1
|
||||
LABEL=$1
|
||||
|
||||
MBIT="$SPEED stream"
|
||||
T="pngcairo size 1000,600 enhanced font \"LiberationSerif,20\""
|
||||
EXT=png
|
||||
#T="pdfcairo"
|
||||
#EXT=pdf
|
||||
|
||||
function runplot {
|
||||
for R in `seq -w 0 100`; do
|
||||
FLDS=( $1 )
|
||||
NAMS=( $2 )
|
||||
|
||||
FN=`ls ${FLDS[0]}/run${R}_*.times 2> /dev/null`
|
||||
if [ -z $FN ] ; then
|
||||
return
|
||||
fi
|
||||
FILE=`basename $FN`
|
||||
|
||||
FN=`ls ${FLDS[0]}/run${R}_*.times 2> /dev/null`
|
||||
TIMES=`basename $FN`
|
||||
VIEWERS=`echo $FILE | cut -d '_' -f 2`
|
||||
TECH=`echo $FILE | cut -d '_' -f 3`
|
||||
SECS=`echo $FILE | cut -d '.' -f 1 | cut -d '_' -f 4`
|
||||
TIME=$(( $SECS / 60 ))m
|
||||
|
||||
FILES=()
|
||||
TIME_FN=()
|
||||
|
||||
for i in `seq $(( ${#FLDS[@]} - 1 )) -1 0`; do
|
||||
FN=`ls ${FLDS[$i]}/run${R}_*.times 2> /dev/null`
|
||||
if [ -z $FN ] ; then
|
||||
return
|
||||
fi
|
||||
FILES[$i]="${FLDS[$i]}/`basename $FN`"
|
||||
FN=`ls ${FLDS[$i]}/run${R}_*.times 2> /dev/null`
|
||||
TIME_FN[$i]="${FLDS[$i]}/`basename $FN`"
|
||||
done
|
||||
|
||||
if [ -n "$3" ] ; then
|
||||
COMMON_DATA="${TIME}, ${MBIT}, ${VIEWERS} $3"
|
||||
CFN="$3_${VIEWERS}_${TIME}"
|
||||
COMMON_FILENAME=${CFN,,}
|
||||
else
|
||||
COMMON_DATA="${TIME}, ${MBIT}, ${VIEWERS} ${TECH}"
|
||||
COMMON_FILENAME="${TECH}_${VIEWERS}_${TIME}"
|
||||
fi
|
||||
|
||||
PLOT5=""
|
||||
for i in `seq $(( ${#FLDS[@]} - 1 )) -1 0`; do
|
||||
if [ -n "${PLOT5}" ] ; then
|
||||
PLOT5="${PLOT5}, "
|
||||
fi
|
||||
sort --field-separator=',' --key=4g < "${TIME_FN[$i]}" > "${TIME_FN[$i]}_sorted"
|
||||
VC=`cut -f 4 -d ',' < "${TIME_FN[$i]}" | awk "(int(\\\$1) >= ${SECS}000-5000) {sum++} END{print sum}"`
|
||||
SC=`cut -f 4 -d ',' < "${TIME_FN[$i]}" | awk "(int(\\\$1) >= ${SECS}000-30000) {sum++} END{print sum}"`
|
||||
#and buffer times. Smoothing makes no sense here. Don't.
|
||||
PLOT5="${PLOT5}'${TIME_FN[$i]}_sorted' using (\$4-${SECS}000)/1000 with linespoints lw 1 title '${NAMS[$i]} (${VC}, ${SC})'"
|
||||
done
|
||||
|
||||
gnuplot << EOF
|
||||
set terminal ${T}
|
||||
set datafile separator ","
|
||||
set key on under center
|
||||
|
||||
#set style fill solid 0.25 border -1
|
||||
#set style boxplot outliers pointtype 7
|
||||
#set style data boxplot
|
||||
#set boxwidth 0.5
|
||||
set pointsize 0.2
|
||||
set arrow from 0,-5 to ${VIEWERS}-1,-5 nohead
|
||||
|
||||
set title "Available buffer time, ${COMMON_DATA} clients"
|
||||
set output '${COMMON_FILENAME}_buffers.${EXT}'
|
||||
set format y "%gs"
|
||||
set ylabel "Buffer size (above line = success)"
|
||||
set xlabel "Each point represents a single connection"
|
||||
unset xtics
|
||||
plot ${PLOT5}
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
for i in `seq $(( ${#FLDS[@]} - 1 )) -1 0`; do
|
||||
rm -f "${FLDS[$i]}/${TIMES}_sorted"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
#runplot "adobe_rtmp nginx_rtmp wowza_rtmp mist_rtmp flus_rtmp" "Adobe Nginx Wowza MistServer Flussonic"
|
||||
|
||||
runplot "$LABEL" "$FOLDER" "$SPEED"
|
||||
|
||||
#runplot "wowza_dash mist_dash wowza_dash_new mist_dash_new mist_dash3" "Wowza Mist WowNew MistNew MistNewer"
|
||||
#runplot "mist_dash mist_dash_new mist_dash3" "Old New Newer" "MistDash"
|
||||
#runplot "wowza_hls_new flus_hls_new mist_hls_new mist_hls5" "Wowza Flus Mist MistNew"
|
||||
#runplot "adobe_rtmp nginx_rtmp wowza_rtmp mist_rtmp flus_rtmp mist_rtmp5" "Adobe Nginx Wowza MistServer Flussonic MistNew"
|
||||
|
192
scripts/plot_run
Executable file
192
scripts/plot_run
Executable file
|
@ -0,0 +1,192 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -z $R ] ; then
|
||||
R=000
|
||||
fi
|
||||
|
||||
if [ -z $MBIT ] ; then
|
||||
MBIT="0.6Mbit stream"
|
||||
fi
|
||||
|
||||
T="pngcairo size 1000,600 enhanced font \"LiberationSerif,20\""
|
||||
EXT=png
|
||||
#T="pdfcairo"
|
||||
#EXT=pdf
|
||||
|
||||
if [ -z "$FOLDERS" ] ; then
|
||||
FOLDERS="wowza nginx mist adobe"
|
||||
fi
|
||||
|
||||
if [ -z "$NAMES" ] ; then
|
||||
NAMES="Wowza Nginx Mist Adobe"
|
||||
fi
|
||||
|
||||
FLDS=( $FOLDERS )
|
||||
NAMS=( $NAMES )
|
||||
|
||||
FN=`ls ${FLDS[0]}/run${R}_*.csv 2> /dev/null`
|
||||
if [ -z $FN ] ; then
|
||||
exit
|
||||
fi
|
||||
FILE=`basename $FN`
|
||||
|
||||
FN=`ls ${FLDS[0]}/run${R}_*.times 2> /dev/null`
|
||||
TIMES=`basename $FN`
|
||||
VIEWERS=`echo $FILE | cut -d '_' -f 2`
|
||||
TECH=`echo $FILE | cut -d '_' -f 3`
|
||||
SECS=`echo $FILE | cut -d '.' -f 1 | cut -d '_' -f 4`
|
||||
TIME=$(( $SECS / 60 ))m
|
||||
|
||||
FILES=()
|
||||
TIME_FN=()
|
||||
|
||||
for i in `seq $(( ${#FLDS[@]} - 1 )) -1 0`; do
|
||||
FN=`ls ${FLDS[$i]}/run${R}_*.csv 2> /dev/null`
|
||||
if [ -z $FN ] ; then
|
||||
exit
|
||||
fi
|
||||
FILES[$i]="${FLDS[$i]}/`basename $FN`"
|
||||
FN=`ls ${FLDS[$i]}/run${R}_*.times 2> /dev/null`
|
||||
TIME_FN[$i]="${FLDS[$i]}/`basename $FN`"
|
||||
done
|
||||
# FN=`ls ${FLDS[0]}/run${R}_*.times 2> /dev/null`
|
||||
# VNAME="TIMES_${i}"
|
||||
# ${!VNAME}=`basename $FN`
|
||||
# VNAME="VIEWERS_${i}"
|
||||
# ${!VNAME}=`echo $FILE | cut -d '_' -f 2`
|
||||
# VNAME="TECH_${i}"
|
||||
# ${!VNAME}=`echo $FILE | cut -d '_' -f 3`
|
||||
# SECS=`echo $FILE | cut -d '.' -f 1 | cut -d '_' -f 4`
|
||||
# VNAME="TIME_${i}"
|
||||
# ${!VNAME}=$(( $SECS / 60 ))m
|
||||
#
|
||||
# done
|
||||
|
||||
COMMON_DATA="${TIME}, ${MBIT}, ${VIEWERS} ${TECH}"
|
||||
COMMON_FILENAME="${TECH}_${VIEWERS}_${TIME}"
|
||||
|
||||
PLOT1=""
|
||||
PLOT2=""
|
||||
PLOT3=""
|
||||
PLOT4=""
|
||||
PLOT5=""
|
||||
PLOT6=""
|
||||
PLOT7=""
|
||||
for i in `seq $(( ${#FLDS[@]} - 1 )) -1 0`; do
|
||||
if [ -n "${PLOT1}" ] ; then
|
||||
PLOT1="${PLOT1}, "
|
||||
PLOT2="${PLOT2}, "
|
||||
PLOT3="${PLOT3}, "
|
||||
PLOT4="${PLOT4}, "
|
||||
PLOT5="${PLOT5}, "
|
||||
PLOT6="${PLOT6}, "
|
||||
PLOT7="${PLOT7}, "
|
||||
fi
|
||||
|
||||
sort --field-separator=',' --key=4g < "${TIME_FN[$i]}" > "${TIME_FN[$i]}_sorted"
|
||||
VC=`cut -f 4 -d ',' < "${TIME_FN[$i]}" | awk "(int(\\\$1) >= ${SECS}000-5000) {sum++} END{print sum}"`
|
||||
SC=`cut -f 4 -d ',' < "${TIME_FN[$i]}" | awk "(int(\\\$1) >= ${SECS}000-30000) {sum++} END{print sum}"`
|
||||
|
||||
#smooth CPU and network
|
||||
PLOT6="${PLOT6}'${FLDS[$i]}/${FILE}' using 1:4:(1) with lines lw 2 title '${NAMS[$i]} (${VC}, ${SC})' smooth acsplines"
|
||||
PLOT7="${PLOT7}'${FLDS[$i]}/${FILE}' using (\$1-dx):(d(\$1,\$5/131072.0)):(1) with lines lw 2 title '${NAMS[$i]} (${VC}, ${SC})' smooth acsplines"
|
||||
|
||||
#actual CPU and network
|
||||
PLOT1="${PLOT1}'${FILES[$i]}' using 1:4 with lines lw 2 title '${NAMS[$i]} (${VC}, ${SC})'"
|
||||
PLOT4="${PLOT4}'${FILES[$i]}' using (\$1-dx):(d(\$1,\$5/131072.0)) with lines lw 2 title '${NAMS[$i]} (${VC}, ${SC})'"
|
||||
|
||||
#memory - no need for smoothing, it's already pretty smooth
|
||||
PLOT2="${PLOT2}'${FILES[$i]}' using 1:(\$3/1024.0) with lines lw 2 title '${NAMS[$i]} (${VC}, ${SC})'"
|
||||
#total upload - same here, no need to smooth anything over
|
||||
PLOT3="${PLOT3}'${FILES[$i]}' using 1:(\$5/134217728.0) with lines lw 2 title '${NAMS[$i]} (${VC}, ${SC})'"
|
||||
#and buffer times. Smoothing makes no sense here. Don't.
|
||||
PLOT5="${PLOT5}'${TIME_FN[$i]}_sorted' using (\$4-${SECS}000)/1000 with linespoints lw 1 title '${NAMS[$i]} (${VC}, ${SC})'"
|
||||
done
|
||||
|
||||
gnuplot << EOF
|
||||
set terminal ${T}
|
||||
set datafile separator ","
|
||||
set key on under center
|
||||
|
||||
#set style fill solid 0.25 border -1
|
||||
#set style boxplot outliers pointtype 7
|
||||
#set style data boxplot
|
||||
#set boxwidth 0.5
|
||||
set pointsize 0.2
|
||||
set arrow from 0,-5 to ${VIEWERS}-1,-5 nohead
|
||||
|
||||
set title "Available buffer time, ${COMMON_DATA} clients"
|
||||
set output '${TECH}_${VIEWERS}_${TIME}_buffers.${EXT}'
|
||||
set format y "%gs"
|
||||
set ylabel "Buffer size (above line = success)"
|
||||
set xlabel "Each point represents a single connection"
|
||||
unset xtics
|
||||
plot ${PLOT5}
|
||||
unset style
|
||||
unset xlabel
|
||||
unset arrow
|
||||
|
||||
set timefmt "%s"
|
||||
set xtics
|
||||
set xdata time
|
||||
#set xlabel "Time (mm:ss)"
|
||||
set format x "%M:%S"
|
||||
set grid
|
||||
|
||||
set title "CPU usage, ${COMMON_DATA} clients"
|
||||
set output '${COMMON_FILENAME}_cpu.${EXT}'
|
||||
set yrange [0:*<100]
|
||||
set format y "%.0f %%"
|
||||
set ylabel "CPU use"
|
||||
plot ${PLOT1}
|
||||
|
||||
set title "Memory usage, ${COMMON_DATA} clients"
|
||||
set output '${COMMON_FILENAME}_mem.${EXT}'
|
||||
set yrange [0<*<0:0<*]
|
||||
set ytics auto
|
||||
set format y "%g MiB"
|
||||
set ylabel "Memory use"
|
||||
plot ${PLOT2}
|
||||
|
||||
set title "Network upload, ${COMMON_DATA} clients"
|
||||
set output '${COMMON_FILENAME}_upload.${EXT}'
|
||||
set yrange [0<*<0:0<*]
|
||||
set ytics auto
|
||||
set format y "%g Gbit"
|
||||
set ylabel "Total uploaded data"
|
||||
plot ${PLOT3}
|
||||
|
||||
# derivative function. Return 1/0 for first point, otherwise delta y or (delta y)/(delta x)
|
||||
d(x,y) = (\$0 == 1) ? (x1 = x, y1 = y, 1/0) : (x2 = x1, x1 = x, y2 = y1, y1 = y, (y1-y2)/(x1-x2))
|
||||
|
||||
set title "Network speed, ${COMMON_DATA} clients"
|
||||
set output '${COMMON_FILENAME}_netspeed.${EXT}'
|
||||
set yrange [0<*<0:0<*]
|
||||
set ytics auto
|
||||
set format y "%g Mbps"
|
||||
set ylabel "Upload speed"
|
||||
dx=0.5
|
||||
plot ${PLOT4}
|
||||
|
||||
set title "Smoothed CPU usage, ${COMMON_DATA} clients"
|
||||
set output '${COMMON_FILENAME}_cpu_smooth.${EXT}'
|
||||
set yrange [0:*<100]
|
||||
set format y "%.0f %%"
|
||||
set ylabel "CPU use"
|
||||
plot ${PLOT6}
|
||||
|
||||
set title "Smoothed network speed, ${COMMON_DATA} clients"
|
||||
set output '${COMMON_FILENAME}_netspeed_smooth.${EXT}'
|
||||
set yrange [0<*<0:0<*]
|
||||
set ytics auto
|
||||
set format y "%g Mbps"
|
||||
set ylabel "Upload speed"
|
||||
dx=0.5
|
||||
plot ${PLOT7}
|
||||
|
||||
EOF
|
||||
|
||||
|
||||
for i in `seq $(( ${#FLDS[@]} - 1 )) -1 0`; do
|
||||
rm -f "${FLDS[$i]}/${TIMES}_sorted"
|
||||
done
|
6
scripts/plot_runs
Executable file
6
scripts/plot_runs
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
for i in `seq -w 0 100`; do
|
||||
R=$i ./plot_run
|
||||
done
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue