import sys sys.path.append('../') import database import pprint from queryconstructor import QueryConstructor from plotconstructor import * filename_prefix = "ping_over_carrier" networkcountry = "us" filename = filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("device", "networkname") qc.addSelectMedian("ping", "avg") qc.addSelectPercentile("ping", "avg", 25) qc.addSelectPercentile("ping", "avg", 75) qc.addSelectField("count(*)") qc.addWhereEqualsString("network", "connectiontype", "Mobile: 3G") qc.addWhereNotEqualsString("device", "networkname", "sprint") qc.addWhereNotEqualsString("device", "networkname", "cricket") qc.addWhereNotEqualsString("device", "networkname", "US Cellular") qc.addWhereNotEqualsString("device", "networkname", "T - Mobile") qc.addWhereNotEqualsString("device", "networkname", "Simple Mobile") qc.addWhereNotEqualsString("device", "networkname", "My Network") qc.addWhereNotEqualsString("device", "networkname", "MetroPCS") qc.addWhereNotEqualsString("device", "networkname", "HOME") qc.addWhereNotEqualsString("device", "networkname", "") qc.addWhereEqualsString("device", "networkcountry", networkcountry) qc.addWhereEqualsString("ping", "dstip", "www.google.com") qc.applyMobileClauses()
import sys sys.path.append('../') import database from queryconstructor import QueryConstructor from plotconstructor import LinePlot, Mapping filename_prefix = "ping_avg_distribution" networkcountry = "us" filename = filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("ping", "5*cast((avg/5) as int)") qc.addSelectField("count(*)") qc.addWhereEqualsString("network", "connectiontype", "Mobile: 3G") qc.addWhereEqualsString("device", "networkcountry", networkcountry) qc.addWhereEqualsString("ping", "dstip", "www.google.com") qc.addWhereLessThan("ping", "avg", 700) qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") qc.addWhereEqualsString("device", "networkname", 'AT&T') result = database.query(qc.toString()) qc = QueryConstructor() qc.setGroupOrderSelectBy("ping", "5*cast((avg/5) as int)") qc.addSelectField("count(*)") qc.addWhereEqualsString("network", "connectiontype", "Mobile: 3G") qc.addWhereEqualsString("device", "networkcountry", networkcountry) qc.addWhereEqualsString("ping", "dstip", "www.google.com") qc.addWhereLessThan("ping", "avg", 700) qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com")
import sys sys.path.append('../') import database from queryconstructor import QueryConstructor from plotconstructor import * filename_prefix = "ping_over_battery_att" networkcountry="us" filename=filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("battery","5*(level/5)") qc.addSelectMedian("ping","avg") qc.addSelectPercentile("ping","avg",25) qc.addSelectPercentile("ping","avg",75) qc.addSelectField("count(*)") qc.addWhereEqualsString("network","connectiontype","Mobile: 3G") qc.addWhereEqualsString("device","networkcountry",networkcountry) qc.addWhereEqualsString("ping","dstip","www.google.com") #qc.addWhereEquals("battery","plugged",0) qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") qc.addWhereEqualsString("device","networkname",'AT&T') result = database.query(qc.toString()) plot = SimpleBarPlot() plot.addMapping(MappingWithBounds(result,0,1,2,3,"AT&T")) plot.setYLabel("ms") plot.setXLabel("battery (in %)")
import sys sys.path.append('../') import database import pprint from queryconstructor import QueryConstructor from plotconstructor import * filename_prefix = "ping_over_devicedesign" networkcountry = "us" filename = filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("device", "devicedesign") qc.addSelectMedian("ping", "avg") qc.addSelectPercentile("ping", "avg", 25) qc.addSelectPercentile("ping", "avg", 75) qc.addSelectField("count(*)") qc.addWhereEqualsString("device", "networkcountry", networkcountry) qc.addWhereNotEqualsString("network", "networktype", "") qc.addWhereEqualsString("network", "networktype", "UMTS") qc.addWhereEqualsString("device", "networkname", "AT&T") qc.addWhereNotEqualsString("device", "devicedesign", "t0lteatt") qc.addWhereNotEqualsString("device", "devicedesign", "olympus") qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") #qc.addWhereEqualsString("device","networkname",'AT&T') result = database.query(qc.toString())
import sys sys.path.append('../') import database import pprint from queryconstructor import QueryConstructor from plotconstructor import LinePlot,Mapping qc=QueryConstructor() qc.addSelect("ping","avg") qc.addWhereRaw("cast(signalstrength as int)>0") qc.addWhereNotEqualsString("device","networkname","") qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") result = database.query(qc.toString()) #pprint.pprint(result) total=0 count=0 for row in result: ratio = 332.0/float(str(row[0])) if ratio>1: ratio=1/ratio accuracy=ratio total+=accuracy count+=1 print total/count
import sys sys.path.append('../') import database import pprint from queryconstructor import QueryConstructor from plotconstructor import * filename_prefix = "ping_over_phonemodel" networkcountry="us" filename=filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("device","phonemodel") qc.addSelectMedian("ping","avg") qc.addSelectPercentile("ping","avg",25) qc.addSelectPercentile("ping","avg",75) qc.addSelectField("count(*)") qc.addWhereEqualsString("device","networkcountry",networkcountry) qc.addWhereNotEqualsString("network","networktype","") qc.addWhereNotEqualsString("device","phonemodel","SGH-T679") qc.addWhereEqualsString("network","networktype","UMTS") qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") #qc.addWhereEqualsString("device","networkname",'AT&T') result = database.query(qc.toString()) pprint.pprint(result) plot = SimpleBarPlot()
import sys sys.path.append('../') import database from queryconstructor import QueryConstructor from plotconstructor import * filename_prefix = "ping_over_battery_att" networkcountry = "us" filename = filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("battery", "5*(level/5)") qc.addSelectMedian("ping", "avg") qc.addSelectPercentile("ping", "avg", 25) qc.addSelectPercentile("ping", "avg", 75) qc.addSelectField("count(*)") qc.addWhereEqualsString("network", "connectiontype", "Mobile: 3G") qc.addWhereEqualsString("device", "networkcountry", networkcountry) qc.addWhereEqualsString("ping", "dstip", "www.google.com") #qc.addWhereEquals("battery","plugged",0) qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") qc.addWhereEqualsString("device", "networkname", 'AT&T') result = database.query(qc.toString()) plot = SimpleBarPlot() plot.addMapping(MappingWithBounds(result, 0, 1, 2, 3, "AT&T")) plot.setYLabel("ms") plot.setXLabel("battery (in %)")
import sys sys.path.append('../') import database from queryconstructor import QueryConstructor from plotconstructor import * level = 95 filename_prefix = "ping_over_battery_att_cdf_" + str(level) networkcountry = "us" filename = filename_prefix plot = LinePlot() qc = QueryConstructor() qc.setGroupOrderSelectBy("ping", "5*cast((avg/5) as int)") qc.addSelectField("count(*)") qc.addWhereLessThan("ping", "avg", 1000) qc.addWhereEqualsString("network", "connectiontype", "Mobile: 3G") qc.addWhereEqualsString("device", "networkcountry", networkcountry) qc.addWhereEqualsString("ping", "dstip", "www.google.com") qc.addWhereLessThan("battery", "level", level) qc.addWhereEquals("battery", "plugged", 0) qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") qc.addWhereEqualsString("device", "networkname", 'AT&T') result = database.query(qc.toString()) plot.addMapping(Mapping(result, 0, 1, "lessThan" + str(level))) qc = QueryConstructor() qc.setGroupOrderSelectBy("ping", "5*cast((avg/5) as int)")
import sys sys.path.append('../') import database from queryconstructor import QueryConstructor from plotconstructor import * level = 95 filename_prefix = "ping_over_battery_att_cdf_"+str(level) networkcountry="us" filename=filename_prefix plot = LinePlot() qc = QueryConstructor() qc.setGroupOrderSelectBy("ping", "5*cast((avg/5) as int)") qc.addSelectField("count(*)") qc.addWhereLessThan("ping","avg",1000) qc.addWhereEqualsString("network","connectiontype","Mobile: 3G") qc.addWhereEqualsString("device","networkcountry",networkcountry) qc.addWhereEqualsString("ping","dstip","www.google.com") qc.addWhereLessThan("battery","level",level) qc.addWhereEquals("battery","plugged",0) qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") qc.addWhereEqualsString("device","networkname",'AT&T') result = database.query(qc.toString()) plot.addMapping(Mapping(result,0,1,"lessThan"+str(level))) qc = QueryConstructor()
import sys sys.path.append('../') import database import pprint from queryconstructor import QueryConstructor from plotconstructor import * networkcountry="us" networktype=sys.argv[1] filename_prefix = "ping_over_signal_att_"+networktype filename=filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("network","cast(signalstrength as int)") qc.addSelectMedian("ping","avg") qc.addSelectPercentile("ping","avg",25) qc.addSelectPercentile("ping","avg",75) qc.addSelectField("count(*)") #qc.addWhereEqualsString("network","connectiontype","Mobile: 3G") qc.addWhereEqualsString("network","networktype",networktype) #qc.addWhereEqualsString("network","cellid","62095") qc.addWhereEqualsString("device","networkcountry",networkcountry) qc.addWhereEqualsString("ping","dstip","www.google.com") qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") qc.addWhereEqualsString("device","networkname",'AT&T')
import sys sys.path.append('../') import database import pprint from queryconstructor import QueryConstructor from plotconstructor import * filename_prefix = "ping_over_signal_att_" filename=filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("network","cast(signalstrength as int)") qc.addSelectMedian("ping","avg") qc.addSelectPercentile("ping","avg",25) qc.addSelectPercentile("ping","avg",75) qc.addSelectField("count(*)") qc.addWhereEqualsString("network","cellid","62095") #qc.addWhereEqualsString("network","cellid","62095") qc.addWhereEqualsString("ping","dstip","www.google.com") qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") result = database.query(qc.toString()) pprint.pprint(result)
import sys sys.path.append('../') import database, query, tuple_gen import pprint from queryconstructor import QueryConstructor from plotconstructor import * # EXAMPLE: warmup_avg_over_sequence 7a64da14bf60b976e7f3048400b0f4daeb0b2d33 deviceid=sys.argv[1] filename_prefix = "warmup_over_sequence_"+deviceid filename=filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("warmup_ping","sequence_count") qc.addSelectMedian("warmup_ping","value") qc.addSelectPercentile("warmup_ping","value",25) qc.addSelectPercentile("warmup_ping","value",75) qc.addSelectField("count(*)") qc.applyMobileClauses() qc.applyWarmupSequenceClauses() qc.addWhereEqualsString("device","deviceid",deviceid) #qc.addWhereGreaterThan("warmup_ping","sequence_count",10) result = database.query(qc.toString()) pprint.pprint(result) plot = SimpleBarPlot()
import sys sys.path.append('../') import database from queryconstructor import QueryConstructor from plotconstructor import LinePlot,Mapping filename_prefix = "ping_avg_distribution" networkcountry="us" filename=filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("ping", "5*cast((avg/5) as int)") qc.addSelectField("count(*)") qc.addWhereEqualsString("network","connectiontype","Mobile: 3G") qc.addWhereEqualsString("device","networkcountry",networkcountry) qc.addWhereEqualsString("ping","dstip","www.google.com") qc.addWhereLessThan("ping","avg",700) qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") qc.addWhereEqualsString("device","networkname",'AT&T') result = database.query(qc.toString()) qc = QueryConstructor() qc.setGroupOrderSelectBy("ping", "5*cast((avg/5) as int)") qc.addSelectField("count(*)") qc.addWhereEqualsString("network","connectiontype","Mobile: 3G") qc.addWhereEqualsString("device","networkcountry",networkcountry) qc.addWhereEqualsString("ping","dstip","www.google.com") qc.addWhereLessThan("ping","avg",700) qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com")
import sys sys.path.append('../') import database import pprint from queryconstructor import QueryConstructor from plotconstructor import * filename_prefix = "ping_over_dow_att_cdf" networkcountry = "us" networkname = "AT&T" filename = filename_prefix plot = LinePlot() qc = QueryConstructor() qc.setGroupOrderSelectBy("ping", "5*cast((avg/5) as int)") qc.addSelectField("count(*)") qc.addWhereLessThan("ping", "avg", 500) qc.addWhereEqualsString("network", "connectiontype", "Mobile: 3G") qc.addWhereEqualsString("device", "networkcountry", networkcountry) qc.addWhereEqualsString("ping", "dstip", "www.google.com") qc.addWhereDayOfWeekMoreThan("measurement", "\"localtime\"", 0) qc.addWhereDayOfWeekLessThan("measurement", "\"localtime\"", 6) qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") qc.addWhereEqualsString("device", "networkname", networkname) result = database.query(qc.toString()) plot.addMapping(Mapping(result, 0, 1, "weekday"))
import sys sys.path.append('../') import database import pprint from queryconstructor import QueryConstructor from plotconstructor import LinePlot, Mapping qc = QueryConstructor() qc.addSelect("ping", "avg") qc.addWhereRaw("cast(signalstrength as int)>0") qc.addWhereNotEqualsString("device", "networkname", "") qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") result = database.query(qc.toString()) #pprint.pprint(result) total = 0 count = 0 for row in result: ratio = 332.0 / float(str(row[0])) if ratio > 1: ratio = 1 / ratio accuracy = ratio total += accuracy count += 1 print total / count
import sys sys.path.append('../') import database import pprint from queryconstructor import QueryConstructor from plotconstructor import * filename_prefix = "ping_over_devicedesign" networkcountry="us" filename=filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("device","devicedesign") qc.addSelectMedian("ping","avg") qc.addSelectPercentile("ping","avg",25) qc.addSelectPercentile("ping","avg",75) qc.addSelectField("count(*)") qc.addWhereEqualsString("device","networkcountry",networkcountry) qc.addWhereNotEqualsString("network","networktype","") qc.addWhereEqualsString("network","networktype","UMTS") qc.addWhereEqualsString("device","networkname","AT&T") qc.addWhereNotEqualsString("device","devicedesign","t0lteatt") qc.addWhereNotEqualsString("device","devicedesign","olympus") qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") #qc.addWhereEqualsString("device","networkname",'AT&T') result = database.query(qc.toString())
import sys sys.path.append('../') import database import pprint from queryconstructor import QueryConstructor from plotconstructor import * filename_prefix = "ping_over_dow_att_cdf" networkcountry="us" networkname="AT&T" filename=filename_prefix plot = LinePlot() qc = QueryConstructor() qc.setGroupOrderSelectBy("ping", "5*cast((avg/5) as int)") qc.addSelectField("count(*)") qc.addWhereLessThan("ping","avg",500) qc.addWhereEqualsString("network","connectiontype","Mobile: 3G") qc.addWhereEqualsString("device","networkcountry",networkcountry) qc.addWhereEqualsString("ping","dstip","www.google.com") qc.addWhereDayOfWeekMoreThan("measurement","\"localtime\"",0) qc.addWhereDayOfWeekLessThan("measurement","\"localtime\"",6) qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") qc.addWhereEqualsString("device","networkname",networkname) result = database.query(qc.toString()) plot.addMapping(Mapping(result,0,1,"weekday"))
import sys sys.path.append('../') import database, query, tuple_gen import pprint from queryconstructor import QueryConstructor from plotconstructor import * # EXAMPLE: warmup_avg_over_sequence GPRS networktype=sys.argv[1] filename_prefix = "warmup_over_sequence_network_"+networktype filename=filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("warmup_ping","sequence_count") qc.addSelectMedian("warmup_ping","value") qc.addSelectPercentile("warmup_ping","value",25) qc.addSelectPercentile("warmup_ping","value",75) qc.addSelectField("count(*)") qc.applyMobileClauses() qc.applyWarmupSequenceClauses() qc.addWhereEqualsString("network","networktype",networktype) qc.addWhereEqualsString("device","networkcountry","us") qc.addWhereEqualsString("device","networkname","AT&T") #qc.addWhereGreaterThan("warmup_ping","sequence_count",10) result = database.query(qc.toString()) pprint.pprint(result)
import numpy as np import matplotlib.pyplot as plt from queryconstructor import QueryConstructor from plotconstructor import * # EXAMPLE: python avg_over_tod_dst_nt.py www.google.com EVDO_A dstip = sys.argv[1] networktype = sys.argv[2] filename = "ping_over_tod_" + networktype plot = LinePlot() times=[{'s':0,'e':6},{'s':6,'e':12},{'s':12,'e':18},{'s':18,'e':24}] for time in times: qc=QueryConstructor() qc.setGroupOrderSelectBy("ping", "5*cast((avg/5) as int)") qc.addSelectField("count(*)") qc.addWhereLessThan("ping","avg",2000) qc.applyMobileClauses() qc.applyLatencyClauses(dstip) qc.addWhereEqualsString("network","networktype",networktype) qc.safeAddTable("measurement") qc.addWhereRaw("date_part('hour',\"localtime\")<"+str(time['e'])) qc.addWhereRaw("date_part('hour',\"localtime\")>"+str(time['s'])) result = database.query(qc.toString()) plot.addMapping(Mapping(result,0,1,str(time['s'])+"to"+str(time['e']))) plot.setYLabel("F(x)") plot.setXLabel("ms") plot.setTitle("Roundtrip latency CDF Graph, for "+ networktype +" network in US, for different time of day")
times = [{ 's': 0, 'e': 6 }, { 's': 6, 'e': 12 }, { 's': 12, 'e': 18 }, { 's': 18, 'e': 24 }] for time in times: qc = QueryConstructor() qc.setGroupOrderSelectBy("ping", "5*cast((avg/5) as int)") qc.addSelectField("count(*)") qc.addWhereLessThan("ping", "avg", 2000) qc.applyMobileClauses() qc.applyLatencyClauses(dstip) qc.addWhereEqualsString("network", "networktype", networktype) qc.safeAddTable("measurement") qc.addWhereRaw("date_part('hour',\"localtime\")<" + str(time['e'])) qc.addWhereRaw("date_part('hour',\"localtime\")>" + str(time['s'])) result = database.query(qc.toString()) plot.addMapping( Mapping(result, 0, 1, str(time['s']) + "to" + str(time['e']))) plot.setYLabel("F(x)")
import sys sys.path.append('../') import database from queryconstructor import QueryConstructor from plotconstructor import SimpleBarPlot filename_prefix = "ping_signalstrength" networktype = sys.argv[1] networkname = sys.argv[2] networkcountry = "us" filename = filename_prefix + "-" filename += networktype + "_" + networkcountry + "_" + networkname qc = QueryConstructor() qc.setGroupOrderSelectBy("network", "cast(signalstrength as int)") qc.addSelectMedian("ping", "avg") qc.addWhereEqualsString("network", "networktype", networktype) qc.addWhereEqualsString("device", "networkcountry", networkcountry) qc.addWhereEqualsString("device", "networkname", networkname) qc.addSelectField("count(*)") qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") result = database.query(qc.toString()) plot = SimpleBarPlot(result) plot.setXticks(0) plot.setYVals(1) plot.setYLabel("ms") plot.setTitle("RTT Latency over signalStrength for US devices only")
import sys sys.path.append('../') import database import pprint from queryconstructor import QueryConstructor from plotconstructor import * filename_prefix = "ping_over_signal_att_" filename = filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("network", "cast(signalstrength as int)") qc.addSelectMedian("ping", "avg") qc.addSelectPercentile("ping", "avg", 25) qc.addSelectPercentile("ping", "avg", 75) qc.addSelectField("count(*)") qc.addWhereEqualsString("network", "cellid", "62095") #qc.addWhereEqualsString("network","cellid","62095") qc.addWhereEqualsString("ping", "dstip", "www.google.com") qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") result = database.query(qc.toString()) pprint.pprint(result) plot = SimpleBarPlot() plot.addMapping(MappingWithBounds(result, 0, 1, 2, 3, "AT&T")) plot.setYLabel("ms") plot.setXLabel("raw signalstrength")
#qc.addSelect("device","devicedesign") #qc.addSelect("network","cellid") qc.addSelect("device","androidversion") qc.addSelect("network","signalstrength") qc.addSelect("network","datastate") qc.safeAddTable("ping") #qc.safeAddTable("warmup_experiment") qc.addSelect("measurement","date_part('hour',\"localtime\")/4") qc.addSelectField("(ping.min>1000 OR (ping.min<0 AND ping.max<0))") #qc.addWhereNotEqualsString("device","networkname","") #qc.addWhereEqualsString("measurement","deviceid","7a64da14bf60b976e7f3048400b0f4daeb0b2d33") #qc.addWhereEqualsString("device","networkcountry","us") qc.applyMobileClauses() #qc.addWhereEqualsString("ping","dstip","www.google.com") qc=QueryConstructor() constructQuery(qc) qc.addWhereRaw("measurement.time<'2012-12-08 00:00:00'") learner_result = database.query(qc.toString()) qc=QueryConstructor() constructQuery(qc) qc.addWhereRaw("measurement.time>'2012-12-08 00:00:00'") eval_result = database.query(qc.toString()) orange = OrangeConstructor() i=0 #orange.add(Column("country",i,"discrete",False))
import sys sys.path.append('../') import database, query, tuple_gen import pprint from queryconstructor import QueryConstructor from plotconstructor import * # EXAMPLE: warmup_avg_over_sequence GPRS networktype = sys.argv[1] filename_prefix = "warmup_over_sequence_network_" + networktype filename = filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("warmup_ping", "sequence_count") qc.addSelectMedian("warmup_ping", "value") qc.addSelectPercentile("warmup_ping", "value", 25) qc.addSelectPercentile("warmup_ping", "value", 75) qc.addSelectField("count(*)") qc.applyMobileClauses() qc.applyWarmupSequenceClauses() qc.addWhereEqualsString("network", "networktype", networktype) qc.addWhereEqualsString("device", "networkcountry", "us") qc.addWhereEqualsString("device", "networkname", "AT&T") #qc.addWhereGreaterThan("warmup_ping","sequence_count",10) result = database.query(qc.toString()) pprint.pprint(result) plot = SimpleBarPlot()
#qc.addSelect("network","cellid") qc.addSelect("device", "androidversion") qc.addSelect("network", "signalstrength") qc.addSelect("network", "datastate") qc.safeAddTable("ping") #qc.safeAddTable("warmup_experiment") qc.addSelect("measurement", "date_part('hour',\"localtime\")/4") qc.addSelectField("(ping.min>1000 OR (ping.min<0 AND ping.max<0))") #qc.addWhereNotEqualsString("device","networkname","") #qc.addWhereEqualsString("measurement","deviceid","7a64da14bf60b976e7f3048400b0f4daeb0b2d33") #qc.addWhereEqualsString("device","networkcountry","us") qc.applyMobileClauses() #qc.addWhereEqualsString("ping","dstip","www.google.com") qc = QueryConstructor() constructQuery(qc) qc.addWhereRaw("measurement.time<'2012-12-08 00:00:00'") learner_result = database.query(qc.toString()) qc = QueryConstructor() constructQuery(qc) qc.addWhereRaw("measurement.time>'2012-12-08 00:00:00'") eval_result = database.query(qc.toString()) orange = OrangeConstructor() i = 0 #orange.add(Column("country",i,"discrete",False)) #i+=1
import sys sys.path.append('../') import database import pprint from queryconstructor import QueryConstructor from plotconstructor import * filename_prefix = "ping_over_phonemodel" networkcountry = "us" filename = filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("device", "phonemodel") qc.addSelectMedian("ping", "avg") qc.addSelectPercentile("ping", "avg", 25) qc.addSelectPercentile("ping", "avg", 75) qc.addSelectField("count(*)") qc.addWhereEqualsString("device", "networkcountry", networkcountry) qc.addWhereNotEqualsString("network", "networktype", "") qc.addWhereNotEqualsString("device", "phonemodel", "SGH-T679") qc.addWhereEqualsString("network", "networktype", "UMTS") qc.applyMobileClauses() qc.applyLatencyClauses("www.google.com") #qc.addWhereEqualsString("device","networkname",'AT&T') result = database.query(qc.toString()) pprint.pprint(result) plot = SimpleBarPlot()
import sys sys.path.append('../') import database import pprint from queryconstructor import QueryConstructor from plotconstructor import * filename_prefix = "ping_over_carrier" networkcountry="us" filename=filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("device","networkname") qc.addSelectMedian("ping","avg") qc.addSelectPercentile("ping","avg",25) qc.addSelectPercentile("ping","avg",75) qc.addSelectField("count(*)") qc.addWhereEqualsString("network","connectiontype","Mobile: 3G") qc.addWhereNotEqualsString("device","networkname","sprint") qc.addWhereNotEqualsString("device","networkname","cricket") qc.addWhereNotEqualsString("device","networkname","US Cellular") qc.addWhereNotEqualsString("device","networkname","T - Mobile") qc.addWhereNotEqualsString("device","networkname","Simple Mobile") qc.addWhereNotEqualsString("device","networkname","My Network") qc.addWhereNotEqualsString("device","networkname","MetroPCS") qc.addWhereNotEqualsString("device","networkname","HOME") qc.addWhereNotEqualsString("device","networkname","") qc.addWhereEqualsString("device","networkcountry",networkcountry) qc.addWhereEqualsString("ping","dstip","www.google.com") qc.applyMobileClauses()
import sys sys.path.append('../') import database, query, tuple_gen import pprint from queryconstructor import QueryConstructor from plotconstructor import * # EXAMPLE: warmup_avg_over_sequence 7a64da14bf60b976e7f3048400b0f4daeb0b2d33 deviceid = sys.argv[1] filename_prefix = "warmup_over_sequence_" + deviceid filename = filename_prefix qc = QueryConstructor() qc.setGroupOrderSelectBy("warmup_ping", "sequence_count") qc.addSelectMedian("warmup_ping", "value") qc.addSelectPercentile("warmup_ping", "value", 25) qc.addSelectPercentile("warmup_ping", "value", 75) qc.addSelectField("count(*)") qc.applyMobileClauses() qc.applyWarmupSequenceClauses() qc.addWhereEqualsString("device", "deviceid", deviceid) #qc.addWhereGreaterThan("warmup_ping","sequence_count",10) result = database.query(qc.toString()) pprint.pprint(result) plot = SimpleBarPlot() plot.addMapping(MappingWithBounds(result, 0, 1, 2, 3, "Device"))