Created
September 18, 2014 03:02
-
-
Save rokujyouhitoma/d736bb68147a93363861 to your computer and use it in GitHub Desktop.
ApacheJMeterの結果データをよきように表すやつ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import pandas | |
import argparse | |
parser = argparse.ArgumentParser(description='xxx') | |
parser.add_argument('csv', type=argparse.FileType('r')) | |
args = parser.parse_args() | |
csv = args.csv | |
df = pandas.read_csv(csv, header=-1, names=['timestamp', 'ms', 'label', 'code', 'status', 'params', 'text', 'bool', 'byte', 'latency']) | |
print(u'リクエスト数: %s' % len(df.index)) | |
print(u'平均レスポンスタイム(ms): %s' % df['ms'].mean()) | |
print(u'レスポンスタイムの中央値(ms): %s' % df['ms'].median()) | |
print(u'90パーセンタイル(ms): %s' % df['ms'].quantile(.90)) | |
print(u'最小レスポンスタイム(ms): %s' % df['ms'].min()) | |
print(u'最大レスポンスタイム(ms): %s' % df['ms'].max()) | |
print(u'エラー割合: %s' % float(len(filter(lambda x: x != 200, df['code'].values)) / float(len(df.index)) * 100)) | |
print(u'スループット(リクエスト数/s): %s' % float( float(len(df.index)) / (df['timestamp'].max() - df['timestamp'].min()) * 1000. )) | |
print(u'転送データ量(KB/s): %s' % float( float(df['byte'].sum()) / (df['timestamp'].max() - df['timestamp'].min()) / 1024 * 1000. )) | |
print(u'計測時間(s): %s' % ((df['timestamp'].max() - df['timestamp'].min()) / 1000.0)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment