提交 9b46f380 编写于 作者: G gyfora 提交者: Stephan Ewen

[streaming] python script added for performance visualization

上级 81fd2cfe
......@@ -20,16 +20,17 @@ public class PerformanceTimer extends PerformanceTracker {
long timer;
boolean millis;
public PerformanceTimer(String name, int counterLength, int countInterval) {
public PerformanceTimer(String name, int counterLength, int countInterval, boolean millis) {
super(name, counterLength, countInterval);
this.millis = millis;
}
public PerformanceTimer(String name) {
public PerformanceTimer(String name, boolean millis) {
super(name);
this.millis = millis;
}
public void startTimer(boolean millis) {
this.millis = millis;
public void startTimer() {
if (millis) {
timer = System.currentTimeMillis();
} else {
......@@ -38,10 +39,6 @@ public class PerformanceTimer extends PerformanceTracker {
}
public void startTimer() {
startTimer(true);
}
public void stopTimer(String label) {
if (millis) {
......
......@@ -94,9 +94,9 @@ public class PerformanceTrackerTest {
@Test
public void testTimer() throws InterruptedException {
PerformanceTimer pT = new PerformanceTimer("timer");
PerformanceTimer pT = new PerformanceTimer("timer",true);
pT.startTimer(true);
pT.startTimer();
Thread.sleep(100);
pT.stopTimer();
......
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 30 15:40:17 2014
@author: gyfora
"""
import matplotlib.pyplot as plt
import pandas as pd
import os
def plotPerformance(csv_dir):
csv_dir=csv_dir
dataframes={}
for fname in os.listdir(csv_dir):
if '.csv' in fname:
df=pd.read_csv(os.path.join(csv_dir,fname),index_col='Time')
speed=[0]
values=list(df.ix[:,0])
for i in range(1,len(values)):
speed.append(float(values[i]-values[i-1])/float(df.index[i]-df.index[i-1]))
df['speed']=speed
dataframes[fname.rstrip('.csv')]=df
plt.figure(figsize=(12, 8), dpi=80)
plt.title('Values')
for name in dataframes.keys():
dataframes[name].ix[:,0].plot()
plt.legend(dataframes.keys())
plt.figure(figsize=(12, 8), dpi=80)
plt.title('dV/dT')
for name in dataframes.keys():
dataframes[name].speed.plot()
plt.legend(dataframes.keys())
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册