0

I have data like this:

x;file-size;duration;mem-size
0;0;0.04456615448;478359552
1;10040000;0.39223408699;562151424
2;20080000;0.725513935089;585662464
3;30120000;1.0728430748;615784448
4;40160000;1.40820503235;692932608
5;50200000;2.27191090584;702971904
6;60240000;2.91427922249;713015296
7;70280000;3.06625103951;857272320
8;80320000;3.59500288963;867311616
9;90360000;4.14507699013;877350912
10;100400000;4.07794499397;887390208
11;110440000;4.49854111671;897429504
12;120480000;6.11765384674;907472896
13;130520000;5.25889492035;917512192
14;140560000;8.49787211418;1195986944
15;150600000;7.62461209297;1206026240
16;160640000;11.1224441528;1216065536
17;170680000;10.2002708912;1226104832
18;180720000;10.042427063;1236148224
19;190760000;10.516712904;1246187520
20;200800000;11.7282280922;1256226816
21;210840000;12.0539629459;1266266112
22;220880000;14.2956900597;1276305408
23;230920000;10.0558278561;1286344704
24;240960000;16.1226639748;1296388096
25;251000000;14.6481440067;1306427392
26;261040000;13.0455079079;1316466688

The first column should be the x axis and the other values should be on the y axis and somehow distinguishable.

It should roughly look like this:

chart

The x value should be the year.

The headings "file-size", "duration", "mem-size" should be taken from the first line of the csv file.

Required features:

  • open source
  • runs on Ubuntu
  • auto-scaling: the tool should check all input values and scale the chart
  • the lines should have the matching heading as annotation
  • If new columns get added it should simply draw an additional line.
  • If programming is needed (I hope it is not), then it should be python

Optional features:

  • callable via command-line
  • 2
    Import to OpenOffice spreadsheet or excel as a delimited file, then use the built in chart making tools. Maybe make it super easy by first doing a search/replace to replace the semicolon with comma, making it a CSV file. – ivanivan Mar 17 at 1:01
1

I think gnuplot can do that. There is a web interface for playing with some sample data.

My personal preference would be to call R from the command line using the Rio script .

0

I used matplotlib and Python:

#!/usr/bin/env python
# Source https://github.com/guettli/misc/blob/master/bench-bytea-inserts-postrgres.py
# Chart: https://github.com/guettli/misc/blob/master/bench-bytea-inserts-postrgres.png

# https://en.wikipedia.org/wiki/Fair_License
#     <Copyright Information>
#    Usage of the works is permitted provided that this instrument is retained with the works, 
#    so that any entity that uses the works is notified of this instrument.
#    DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.

import os
import time
import matplotlib.pyplot as plt
import numpy

import psycopg2

db = psycopg2.connect(dbname=os.environ['USER'])
cursor = db.cursor()
cursor.execute('''
drop table if exists bytea_test;
create table bytea_test (
    data bytea
    )
;
''')
random_stream = open('/dev/urandom', 'rb')
rows=[]
for i in range(0, 1*10**8, 10000000):
    data = psycopg2.Binary(random_stream.read(i))
    start_time = time.time()
    cursor.execute('''insert into bytea_test values (%s)''', (data,))
    duration_random = time.time()-start_time

    data = 'x'*i
    start_time = time.time()
    cursor.execute('''insert into bytea_test values (%s)''', (data,))
    duration_ascii = time.time()-start_time
    kilo_bytes = i / 1000
    row = (kilo_bytes, duration_ascii, duration_random)
    print('{},'.format(row))
    rows.append(row)
m = numpy.array(rows).transpose()
plt.plot(m[0], m[1], label='ascii')
plt.plot(m[0], m[2], label='random')
plt.legend()
plt.xlabel('kilo bytes insert into bytea column')
plt.ylabel('duriation (seconds)')
plt.show()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.