def get_data(ds): player = LogPlayer( ds ) analyzer = XYAnalyzer( mapper=lambda e: (datetime.fromtimestamp(mktime(e.timestamp)).isocalendar()[1] + datetime.fromtimestamp(mktime(e.timestamp)).isocalendar()[2]/7.0, 1) ) player.add_analyzer(analyzer) player.forward() X,Y = analyzer.get_xy() return aggregate(X,Y)
def get_data(ds): player = LogPlayer(ds) analyzer = XYAnalyzer(mapper=lambda e: (e.timestamp.tm_hour + (e.timestamp.tm_min/30*30)/60.0, e.proc_ms )) player.add_analyzer(analyzer) player.forward() X,Y = analyzer.get_xy() return aggregate(X,Y)
def get_data(ds): player = LogPlayer( ds ) analyzer = XYAnalyzer( mapper=lambda e: (e.timestamp.tm_wday + (e.timestamp.tm_hour / 24.0), 1) ) player.add_analyzer(analyzer) player.forward() X,Y = analyzer.get_xy() return aggregate(X,Y)
def get_data(path, mpr, aggregator): ds = CsvFileSource(path, event_type="WMS") player = LogPlayer(ds) analyzer = XYAnalyzer(mapper=mpr) player.add_analyzer(analyzer) player.forward() X, Y = analyzer.get_xy() return aggregator(X, Y)
def get_data(path, mapper, reducer): ds = CsvFileSource(path, event_type='WMS') player = LogPlayer(ds) analyzer = XYAnalyzer(mapper=mapper) player.add_analyzer(analyzer) player.forward() X,Y = analyzer.get_xy() #print X,Y return reducer(X,Y)
def make_plot(ds, title, color): player = LogPlayer(ds) analyzer = XYAnalyzer(mapper=lambda e: (e.timestamp.tm_hour + (e.timestamp.tm_min/15*15)/60.0, e.answer_size / 1024.0), filter=lambda e: e.answer_size > 0) player.add_analyzer(analyzer) player.forward() X,Y = analyzer.get_xy() X, Ymin, Yavg, Ymax = aggregate(X,Y) #plt.axis([0, len(X), 0, max(Yavg)]) plt.title(title) plt.xlabel('Hour of day') plt.ylabel('Average answer size in kilobytes (KB)') plt.plot(X, Yavg, color) plt.show()
def get_data(path, mpr, aggregator): ds = CsvFileSource(path, event_type='WMS') player = LogPlayer(ds) analyzer = XYAnalyzer(mapper=mpr) player.add_analyzer(analyzer) player.forward() X, Y = analyzer.get_xy() return aggregator(X, Y)
def get_data(ds): player = LogPlayer(ds) #analyzer = XYAnalyzer(mapper=lambda e: (e.timestamp.tm_hour + (e.timestamp.tm_min/15*15)/60.0, e.proc_ms )) analyzer = XYAnalyzer(mapper=lambda e: (e.timestamp.tm_hour + (e.timestamp.tm_min/15*15)/60.0, 256.0**2 * e.proc_ms / float(e.query.width*e.query.height) )) player.add_analyzer(analyzer) player.forward() X,Y = analyzer.get_xy() return aggregate(X,Y)
def get_data(ds): player = LogPlayer(ds) analyzer = XYAnalyzer(mapper=lambda e: (e.timestamp.tm_hour + ( e.timestamp.tm_min / 30 * 30) / 60.0, 1 / 30.0)) player.add_analyzer(analyzer) player.forward() X, Y = analyzer.get_xy() return aggregate(X, Y)
def get_data(ds): player = LogPlayer(ds) analyzer = XYAnalyzer(mapper=lambda e: (e.timestamp.tm_wday + (e.timestamp.tm_hour / 24.0), 1)) player.add_analyzer(analyzer) player.forward() X, Y = analyzer.get_xy() return aggregate(X, Y)
def get_data(path, mapper, reducer): ds = CsvFileSource(path, event_type='WMS') player = LogPlayer(ds) analyzer = XYAnalyzer(mapper=mapper) player.add_analyzer(analyzer) player.forward() X, Y = analyzer.get_xy() #print X,Y return reducer(X, Y)
def get_data(ds): player = LogPlayer(ds) analyzer = XYAnalyzer(mapper=lambda e: (datetime.fromtimestamp( mktime(e.timestamp)).isocalendar()[1] + datetime.fromtimestamp( mktime(e.timestamp)).isocalendar()[2] / 7.0, 1)) player.add_analyzer(analyzer) player.forward() X, Y = analyzer.get_xy() return aggregate(X, Y)