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0bASvLѻ=s*#xaTw	EF,XDYm;v>ܹG܆Ie
y T 0bAS~#N?^]x˞UF3L	0(l,cX3=eaQ$.{ץOC^Xp)]`-e,">/}h7)߱VpvZ^oyh7_?zDõ9qPKVERSION33PKAContent/PK^|{N&Content/BinaryStylesheetPK1sContent/LayoutConfigurationPKǸU"
4Content/PartConfigurationPKg*Content/Preferences.jsonPKDõq9HContent/score.gpifPKUVERSIONPK


png tweaks

png tweaks

# print 'plot title   : ' . plottitle
# print 'session id   : ' . session
# print 'max time     : ' . maxtime
# print 'timetics     : ' . timetics
# print 'maxslots     : ' . maxslots
# print 'pilotnum     : ' . pilotnum
# print 'nodesize     : ' . nodesize

if (pilotnum >= 1) {
    pilot_states_1_dat    = '/tmp/rp.' . session . '.pilot.states.'    . pilot_1_id . '.dat'
    pilot_callbacks_1_dat = '/tmp/rp.' . session . '.pilot.callbacks.' . pilot_1_id . '.dat'
    pilot_slots_1_dat     = '/tmp/rp.' . session . '.pilot.slots.'     . pilot_1_id . '.dat'
    pilot_queue_1_dat     = '/tmp/rp.' . session . '.pilot.queue.'     . pilot_1_id . '.dat'
    unit_states_1_dat     = '/tmp/rp.' . session . '.unit.states.'     . pilot_1_id . '.dat'
    unit_callbacks_1_dat  = '/tmp/rp.' . session . '.unit.callbacks.'  . pilot_1_id . '.dat'
  # print 'pilot 1     : ' . pilot_1_name
}
if (pilotnum >= 2) {
    pilot_states_2_dat    = '/tmp/rp.' . session . '.pilot.states.'    . pilot_2_id . '.dat'
    pilot_callbacks_2_dat = '/tmp/rp.' . session . '.pilot.callbacks.' . pilot_2_id . '.dat'
    pilot_slots_2_dat     = '/tmp/rp.' . session . '.pilot.slots.'     . pilot_2_id . '.dat'
    pilot_queue_2_dat     = '/tmp/rp.' . session . '.pilot.queue.'     . pilot_2_id . '.dat'
    unit_states_2_dat     = '/tmp/rp.' . session . '.unit.states.'     . pilot_2_id . '.dat'
    unit_callbacks_2_dat  = '/tmp/rp.' . session . '.unit.callbacks.'  . pilot_2_id . '.dat'
  # print 'pilot 2     : ' . pilot_2_name
}

if (pilotnum >= 3) {
    pilot_states_3_dat    = '/tmp/rp.' . session . '.pilot.states.'    . pilot_3_id . '.dat'
    pilot_callbacks_3_dat = '/tmp/rp.' . session . '.pilot.callbacks.' . pilot_3_id . '.dat'
    pilot_slots_3_dat     = '/tmp/rp.' . session . '.pilot.slots.'     . pilot_3_id . '.dat'
    pilot_queue_3_dat     = '/tmp/rp.' . session . '.pilot.queue.'     . pilot_3_id . '.dat'
    unit_states_3_dat     = '/tmp/rp.' . session . '.unit.states.'     . pilot_3_id . '.dat'
    unit_callbacks_3_dat  = '/tmp/rp.' . session . '.unit.callbacks.'  . pilot_3_id . '.dat'
  # print 'pilot 3     : ' . pilot_3_name
}

if (pilotnum >= 4) {
    print "only support up to three pilots"
    exit
}

terms = 'png pdf'
do for [term_i=1:words(terms)] {
    t = word(terms, term_i)
    term_t = t.'cairo'

    # --------------------------------------------------------------------------------------------------
    #
    # base parameters
    #
    set key Left left

    if (t eq 'pdf') {
        term_mult  = 6.0
        term_x     = 70
        term_y     = 70
        term_font  = 'Monospace,6'
        term_dl    = 7
        term_lw    = 3

        set key    font ",6"
        set xlabel font ",6"
        set ylabel font ",6"
        set title  font ",6"

    } else {
        term_mult  = 6.0
        term_x     = '6000'
        term_y     = '6000'
        term_font  = 'Monospace,8'
        term_dl    = 6
        term_lw    = 1

        set key    font ",8"
        set xlabel font ",8"
        set ylabel font ",8"
        set title  font ",8"
    }

    # pilot 1: pilot states, pilot notifications
    #          unit states, unit state notifications,
    #          slots, maxslots
    set style line 100 lt 1 lc rgb '#FF9944' pt 7 ps term_mult*0.6 lw term_mult*2
    set style line 101 lt 1 lc rgb '#AA6666' pt 6 ps term_mult*0.4 lw term_mult*1
    set style line 102 lt 1 lc rgb '#FF9944' pt 7 ps term_mult*0.6 lw term_mult*2
    set style line 103 lt 1 lc rgb '#AA6666' pt 6 ps term_mult*0.4 lw term_mult*1
    set style line 104 lt 1 lc rgb '#FF9944' pt 7 ps term_mult*0.6 lw term_mult*3
    set style line 105 lt 2 lc rgb '#AA6666' pt 7 ps term_mult*0.6 lw term_mult*3

    set style line 200 lt 1 lc rgb '#99FF44' pt 7 ps term_mult*0.6 lw term_mult*2
    set style line 201 lt 1 lc rgb '#66AA66' pt 6 ps term_mult*0.4 lw term_mult*1
    set style line 202 lt 1 lc rgb '#99FF44' pt 7 ps term_mult*0.6 lw term_mult*2
    set style line 203 lt 1 lc rgb '#66AA66' pt 6 ps term_mult*0.4 lw term_mult*1
    set style line 204 lt 1 lc rgb '#99FF44' pt 7 ps term_mult*0.6 lw term_mult*3
    set style line 205 lt 2 lc rgb '#66AA66' pt 7 ps term_mult*0.6 lw term_mult*3

    set style line 300 lt 1 lc rgb '#9944FF' pt 7 ps term_mult*0.6 lw term_mult*2
    set style line 301 lt 1 lc rgb '#6666AA' pt 6 ps term_mult*0.4 lw term_mult*1
    set style line 302 lt 1 lc rgb '#9944FF' pt 7 ps term_mult*0.6 lw term_mult*2
    set style line 303 lt 1 lc rgb '#6666AA' pt 6 ps term_mult*0.4 lw term_mult*1
    set style line 304 lt 1 lc rgb '#9944FF' pt 7 ps term_mult*0.6 lw term_mult*3
    set style line 305 lt 2 lc rgb '#6666AA' pt 7 ps term_mult*0.6 lw term_mult*3

  # set mxtics 10
  # set mytics 10
    set tics   scale 1.5

    set term       term_t enhanced color dashed \
        size       term_x,term_y \
        font       term_font     \
        fontscale  term_mult     \
        dashlength term_dl       \
        linewidth term_lw

    # --------------------------------------------------------------------------------------------------
    set output './'.session.'.'.t
    print      './'.session.'.'.t

    set title  ''

    set tmargin  0
    set bmargin  0
    set lmargin 25
    set rmargin 10
    set border  lw 4.0

  # set size 1.0,1.5
    set multiplot layout 4,1 title "\n\n" . plottitle . "\n\n\n\n"

    # ------------------------------------------------------------------------------------
    set xrange [0:maxtime]
    set xtics  timetics
    set yrange [0:8]
    set ytics  ("PENDING LAUNCH" 1, \
                "LAUNCHING     " 2, \
                "PENDING ACTIVE" 3, \
                "ACTIVE        " 4, \
                "DONE          " 5, \
                "CANCELED      " 6, \
                "FAILED        " 7)
    set xlabel  ''
    set ylabel "PILOTS\n[states]" offset second -0.06,0
    set format x ""
    set grid

    if (pilotnum==1) {
        plot pilot_states_1_dat    using 1:($2-0.1) title '' with linespoints ls 100 , \
             pilot_callbacks_1_dat using 1:($2+0.1) title '' with      points ls 101
    }
    if (pilotnum==2) {
        plot pilot_states_1_dat    using 1:($2-0.1) title '' with steps       ls 100 , \
             pilot_callbacks_1_dat using 1:($2+0.1) title '' with      points ls 101 , \
             pilot_states_2_dat    using 1:($2-0.1) title '' with steps       ls 200 , \
             pilot_callbacks_2_dat using 1:($2+0.1) title '' with      points ls 201
    }
    if (pilotnum==3) {
        plot pilot_states_1_dat    using 1:($2-0.1) title '' with linespoints ls 100 , \
             pilot_callbacks_1_dat using 1:($2+0.1) title '' with      points ls 101 , \
             pilot_states_2_dat    using 1:($2-0.1) title '' with linespoints ls 200 , \
             pilot_callbacks_2_dat using 1:($2+0.1) title '' with      points ls 201 , \
             pilot_states_3_dat    using 1:($2-0.1) title '' with linespoints ls 300 , \
             pilot_callbacks_3_dat using 1:($2+0.1) title '' with      points ls 301
    }

    # ------------------------------------------------------------------------------------
    set xrange [0:maxtime]
    set yrange [0:12]
    set ytics  ("NEW            "  1, \
                "PEND.   INPUT  "  2, \
                "TRANSF. INPUT  "  3, \
                "PEND. EXECUTION"  4, \
                "SCHEDULING     "  5, \
                "EXECUTING      "  6, \
                "PEND.   OUTPUT "  7, \
                "TRANSF. OUTPUT "  8, \
                "DONE           "  9, \
                "CANCELED       " 10, \
                "FAILED         " 11)

    set xlabel ''
    set ylabel "UNITS\n[states]" offset second -0.06,0
    set format x ""
    set grid

    if (pilotnum==1) {
        plot unit_states_1_dat    using 1:($2-0.1) title '' with steps ls 100 , \
             unit_callbacks_1_dat using 1:($2+0.1) title '' with points ls 101
    }
    if (pilotnum==2) {
        plot unit_states_1_dat    using 1:($2-0.1) title '' with steps  ls 100 , \
             unit_callbacks_1_dat using 1:($2+0.1) title '' with points ls 101 , \
             unit_states_2_dat    using 1:($2-0.1) title '' with steps  ls 200 , \
             unit_callbacks_2_dat using 1:($2+0.1) title '' with points ls 201
    }
    if (pilotnum==3) {
        plot unit_states_1_dat    using 1:($2-0.1) title '' with steps  ls 100 , \
             unit_callbacks_1_dat using 1:($2+0.1) title '' with points ls 101 , \
             unit_states_2_dat    using 1:($2-0.1) title '' with steps  ls 200 , \
             unit_callbacks_2_dat using 1:($2+0.1) title '' with points ls 201 , \
             unit_states_3_dat    using 1:($2-0.1) title '' with steps  ls 300 , \
             unit_callbacks_3_dat using 1:($2+0.1) title '' with points ls 301
    }

    # ------------------------------------------------------------------------------------
    set xrange [0:maxtime]
    set yrange [1:maxslots+nodesize/2]
    set ytics  nodesize
    set y2tics autofreq

    set xlabel ''
    set ylabel "PILOT ACTIVITY\n[slots / unit queue]" offset second -11,0
    set grid

    if (pilotnum==1) {
      plot pilot_slots_1_dat using 1:($2+0.0) title '' with lines ls 104 , \
           pilot_queue_1_dat using 1:($2+0.1) title '' with steps ls 104 axes x1y2 , \
           slotnum_1                          title '' with lines ls 105
    }
    if (pilotnum==2) {
      plot pilot_slots_1_dat using 1:($2+0.0) title '' with lines ls 104 , \
           pilot_queue_1_dat using 1:($2+0.0) title '' with steps ls 104 axes x1y2 , \
           slotnum_1                          title '' with lines ls 105 , \
           pilot_slots_2_dat using 1:($2+0.3) title '' with lines ls 204 , \
           pilot_queue_2_dat using 1:($2+0.3) title '' with steps ls 204 axes x1y2 , \
           slotnum_2                          title '' with lines ls 205
    }
    if (pilotnum==3) {
      plot pilot_slots_1_dat using 1:($2+0.0) title '' with lines ls 104 , \
           pilot_queue_1_dat using 1:($2+0.0) title '' with steps ls 104 axes x1y2 , \
           slotnum_1                          title '' with lines ls 105 , \
           pilot_slots_2_dat using 1:($2+0.2) title '' with lines ls 204 , \
           pilot_queue_2_dat using 1:($2+0.2) title '' with steps ls 204 axes x1y2 , \
           slotnum_2                          title '' with lines ls 205 , \
           pilot_slots_3_dat using 1:($2+0.4) title '' with lines ls 304 , \
           pilot_queue_3_dat using 1:($2+0.4) title '' with steps ls 304 axes x1y2 , \
           slotnum_3                          title '' with lines ls 305
    }

    # ------------------------------------------------------------------------------------
    # Key plot
    set   tmargin 7
    set   lmargin 24
    set   border  lw 0
    unset tics
    unset xlabel
    set   ylabel ""# "Legend and\nStatistics" offset second -17,0
    set   yrange [0:1]
    if (pilotnum==1) {
      set  key center left reverse
      plot NaN lw   0 t 'PILOT 1 ('.pilot_1_name.'):'                      , \
           NaN ls 100 t 'pilot/unit states recorded by RP agent'           , \
           NaN ls 101 t 'pilot/unit states notified to application'        , \
           NaN ls 104 t 'busy slot (i.e. used CPU core)'
    }
    if (pilotnum==2) {
      set   key top left reverse maxrows 4
      plot NaN lw   0 t 'PILOT 1 ('.pilot_1_name.'):'                      , \
           NaN ls 100 t 'pilot/unit states recorded by RP agent'           , \
           NaN ls 101 t 'pilot/unit states notified to application   '     , \
           NaN ls 104 t 'busy slot (i.e. used CPU core)'                   , \
           NaN lw   0 t 'PILOT 2 ('.pilot_2_name.'):'                      , \
           NaN ls 200 t 'pilot/unit states recorded by RP agent'           , \
           NaN ls 201 t 'pilot/unit states notified to application'        , \
           NaN ls 204 t 'busy slot (i.e. used CPU core)'
    }
    if (pilotnum==3) {
      set   key top left reverse maxrows 9
      plot NaN lw   0 t 'PILOT 1 ('.pilot_1_name.'):'                      , \
           NaN ls 100 t 'pilot/unit states recorded by RP agent'           , \
           NaN ls 101 t 'pilot/unit states notified to application   '     , \
           NaN ls 104 t 'busy slot (i.e. used CPU core)'                   , \
           NaN lw   0 t ' '                                                , \
           NaN lw   0 t 'PILOT 2 ('.pilot_2_name.'):'                      , \
           NaN ls 200 t 'pilot/unit states recorded by RP agent'           , \
           NaN ls 201 t 'pilot/unit states notified to application'        , \
           NaN ls 204 t 'busy slot (i.e. used CPU core)'                   , \
           NaN lw   0 t 'PILOT 3 ('.pilot_3_name.'):'                      , \
           NaN ls 300 t 'pilot/unit states recorded by RP agent'           , \
           NaN ls 301 t 'pilot/unit states notified to application'        , \
           NaN ls 304 t 'busy slot (i.e. used CPU core)'                   , \
           NaN lw   0 t ' '                                                , \
           NaN lw   0 t ' '                                                , \
           NaN lw   0 t ' '                                                , \
           NaN lw   0 t ' '
    }
    # ------------------------------------------------------------------------------------

    unset multiplot
    # ------------------------------------------------------------------------------------

}

# ------------------------------------------------------------------------------
# vim: ft=gnuplot

# print 'plot title   : ' . plottitle
# print 'session id   : ' . session
# print 'max time     : ' . maxtime
# print 'timetics     : ' . timetics
# print 'maxslots     : ' . maxslots
# print 'pilotnum     : ' . pilotnum
# print 'nodesize     : ' . nodesize

if (pilotnum >= 1) {
    pilot_states_1_dat    = '/tmp/rp.' . session . '.pilot.states.'    . pilot_1_id . '.dat'
    pilot_callbacks_1_dat = '/tmp/rp.' . session . '.pilot.callbacks.' . pilot_1_id . '.dat'
    pilot_slots_1_dat     = '/tmp/rp.' . session . '.pilot.slots.'     . pilot_1_id . '.dat'
    pilot_queue_1_dat     = '/tmp/rp.' . session . '.pilot.queue.'     . pilot_1_id . '.dat'
    unit_states_1_dat     = '/tmp/rp.' . session . '.unit.states.'     . pilot_1_id . '.dat'
    unit_callbacks_1_dat  = '/tmp/rp.' . session . '.unit.callbacks.'  . pilot_1_id . '.dat'
  # print 'pilot 1     : ' . pilot_1_name
}
if (pilotnum >= 2) {
    pilot_states_2_dat    = '/tmp/rp.' . session . '.pilot.states.'    . pilot_2_id . '.dat'
    pilot_callbacks_2_dat = '/tmp/rp.' . session . '.pilot.callbacks.' . pilot_2_id . '.dat'
    pilot_slots_2_dat     = '/tmp/rp.' . session . '.pilot.slots.'     . pilot_2_id . '.dat'
    pilot_queue_2_dat     = '/tmp/rp.' . session . '.pilot.queue.'     . pilot_2_id . '.dat'
    unit_states_2_dat     = '/tmp/rp.' . session . '.unit.states.'     . pilot_2_id . '.dat'
    unit_callbacks_2_dat  = '/tmp/rp.' . session . '.unit.callbacks.'  . pilot_2_id . '.dat'
  # print 'pilot 2     : ' . pilot_2_name
}

if (pilotnum >= 3) {
    pilot_states_3_dat    = '/tmp/rp.' . session . '.pilot.states.'    . pilot_3_id . '.dat'
    pilot_callbacks_3_dat = '/tmp/rp.' . session . '.pilot.callbacks.' . pilot_3_id . '.dat'
    pilot_slots_3_dat     = '/tmp/rp.' . session . '.pilot.slots.'     . pilot_3_id . '.dat'
    pilot_queue_3_dat     = '/tmp/rp.' . session . '.pilot.queue.'     . pilot_3_id . '.dat'
    unit_states_3_dat     = '/tmp/rp.' . session . '.unit.states.'     . pilot_3_id . '.dat'
    unit_callbacks_3_dat  = '/tmp/rp.' . session . '.unit.callbacks.'  . pilot_3_id . '.dat'
  # print 'pilot 3     : ' . pilot_3_name
}

if (pilotnum >= 4) {
    print "only support up to three pilots"
    exit
}

terms = 'png pdf'
do for [term_i=1:words(terms)] {
    t = word(terms, term_i)
    term_t = t.'cairo'

    # --------------------------------------------------------------------------------------------------
    #
    # base parameters
    #
    set key Left left

    if (t eq 'pdf') {
        term_mult  = 6.0
        term_x     = 70
        term_y     = 70
        term_font  = 'Monospace,6'
        term_dl    = 7
        term_lw    = 3

        set key    font ",6"
        set xlabel font ",6"
        set ylabel font ",6"
        set title  font ",6"

    } else {
        term_mult  = 7.0
        term_x     = '6000'
        term_y     = '6000'
        term_font  = 'Monospace,6'
        term_dl    = 6
        term_lw    = 1

        set key    font ",6"
        set xlabel font ",6"
        set ylabel font ",6"
        set title  font ",6"
    }

    # pilot 1: pilot states, pilot notifications
    #          unit states, unit state notifications,
    #          slots, maxslots
    set style line 100 lt 1 lc rgb '#FF9944' pt 7 ps term_mult*0.6 lw term_mult*2
    set style line 101 lt 1 lc rgb '#AA6666' pt 6 ps term_mult*0.4 lw term_mult*1
    set style line 102 lt 1 lc rgb '#FF9944' pt 7 ps term_mult*0.6 lw term_mult*2
    set style line 103 lt 1 lc rgb '#AA6666' pt 6 ps term_mult*0.4 lw term_mult*1
    set style line 104 lt 1 lc rgb '#FF9944' pt 7 ps term_mult*0.6 lw term_mult*3
    set style line 105 lt 2 lc rgb '#AA6666' pt 7 ps term_mult*0.6 lw term_mult*3

    set style line 200 lt 1 lc rgb '#99FF44' pt 7 ps term_mult*0.6 lw term_mult*2
    set style line 201 lt 1 lc rgb '#66AA66' pt 6 ps term_mult*0.4 lw term_mult*1
    set style line 202 lt 1 lc rgb '#99FF44' pt 7 ps term_mult*0.6 lw term_mult*2
    set style line 203 lt 1 lc rgb '#66AA66' pt 6 ps term_mult*0.4 lw term_mult*1
    set style line 204 lt 1 lc rgb '#99FF44' pt 7 ps term_mult*0.6 lw term_mult*3
    set style line 205 lt 2 lc rgb '#66AA66' pt 7 ps term_mult*0.6 lw term_mult*3

    set style line 300 lt 1 lc rgb '#9944FF' pt 7 ps term_mult*0.6 lw term_mult*2
    set style line 301 lt 1 lc rgb '#6666AA' pt 6 ps term_mult*0.4 lw term_mult*1
    set style line 302 lt 1 lc rgb '#9944FF' pt 7 ps term_mult*0.6 lw term_mult*2
    set style line 303 lt 1 lc rgb '#6666AA' pt 6 ps term_mult*0.4 lw term_mult*1
    set style line 304 lt 1 lc rgb '#9944FF' pt 7 ps term_mult*0.6 lw term_mult*3
    set style line 305 lt 2 lc rgb '#6666AA' pt 7 ps term_mult*0.6 lw term_mult*3

  # set mxtics 10
  # set mytics 10
    set tics   scale 1.5

    set term       term_t enhanced color dashed \
        size       term_x,term_y \
        font       term_font     \
        fontscale  term_mult     \
        dashlength term_dl       \
        linewidth term_lw

    # --------------------------------------------------------------------------------------------------
    set output './'.session.'.'.t
    print      './'.session.'.'.t

    set title  ''

    set tmargin  0
    set bmargin  0
    set lmargin 25
    set rmargin 10
    set border  lw 4.0

  # set size 1.0,1.5
    set multiplot layout 4,1 title "\n\n" . plottitle . "\n\n\n\n"

    # ------------------------------------------------------------------------------------
    set xrange [0:maxtime]
    set xtics  timetics
    set yrange [0:8]
    set ytics  ("PENDING LAUNCH" 1, \
                "LAUNCHING     " 2, \
                "PENDING ACTIVE" 3, \
                "ACTIVE        " 4, \
                "DONE          " 5, \
                "CANCELED      " 6, \
                "FAILED        " 7)
    set xlabel  ''
    set ylabel "PILOTS\n[states]" offset second -0.06,0
    set format x ""
    set grid

    if (pilotnum==1) {
        plot pilot_states_1_dat    using 1:($2-0.1) title '' with linespoints ls 100 , \
             pilot_callbacks_1_dat using 1:($2+0.1) title '' with      points ls 101
    }
    if (pilotnum==2) {
        plot pilot_states_1_dat    using 1:($2-0.1) title '' with steps       ls 100 , \
             pilot_callbacks_1_dat using 1:($2+0.1) title '' with      points ls 101 , \
             pilot_states_2_dat    using 1:($2-0.1) title '' with steps       ls 200 , \
             pilot_callbacks_2_dat using 1:($2+0.1) title '' with      points ls 201
    }
    if (pilotnum==3) {
        plot pilot_states_1_dat    using 1:($2-0.1) title '' with linespoints ls 100 , \
             pilot_callbacks_1_dat using 1:($2+0.1) title '' with      points ls 101 , \
             pilot_states_2_dat    using 1:($2-0.1) title '' with linespoints ls 200 , \
             pilot_callbacks_2_dat using 1:($2+0.1) title '' with      points ls 201 , \
             pilot_states_3_dat    using 1:($2-0.1) title '' with linespoints ls 300 , \
             pilot_callbacks_3_dat using 1:($2+0.1) title '' with      points ls 301
    }

    # ------------------------------------------------------------------------------------
    set xrange [0:maxtime]
    set yrange [0:12]
    set ytics  ("NEW            "  1, \
                "PEND.   INPUT  "  2, \
                "TRANSF. INPUT  "  3, \
                "PEND. EXECUTION"  4, \
                "SCHEDULING     "  5, \
                "EXECUTING      "  6, \
                "PEND.   OUTPUT "  7, \
                "TRANSF. OUTPUT "  8, \
                "DONE           "  9, \
                "CANCELED       " 10, \
                "FAILED         " 11)

    set xlabel ''
    set ylabel "UNITS\n[states]" offset second -0.06,0
    set format x ""
    set grid

    if (pilotnum==1) {
        plot unit_states_1_dat    using 1:($2-0.1) title '' with linespoints ls 102 , \
             unit_callbacks_1_dat using 1:($2+0.1) title '' with      points ls 103
    }
    if (pilotnum==2) {
        plot unit_states_1_dat    using 1:($2-0.1) title '' with steps  ls 102 , \
             unit_callbacks_1_dat using 1:($2+0.1) title '' with points ls 103 , \
             unit_states_2_dat    using 1:($2-0.1) title '' with steps  ls 202 , \
             unit_callbacks_2_dat using 1:($2+0.1) title '' with points ls 203
    }
    if (pilotnum==3) {
        plot unit_states_1_dat    using 1:($2-0.1) title '' with linespoints ls 102 , \
             unit_callbacks_1_dat using 1:($2+0.1) title '' with      points ls 103 , \
             unit_states_2_dat    using 1:($2-0.1) title '' with linespoints ls 202 , \
             unit_callbacks_2_dat using 1:($2+0.1) title '' with      points ls 203 , \
             unit_states_3_dat    using 1:($2-0.1) title '' with linespoints ls 302 , \
             unit_callbacks_3_dat using 1:($2+0.1) title '' with      points ls 303
    }

    # ------------------------------------------------------------------------------------
    set xrange [0:maxtime]
    set yrange [1:maxslots+nodesize/2]
    set ytics  nodesize
    set y2tics autofreq

    set xlabel ''
    set ylabel "PILOT ACTIVITY\n[slots / unit queue]" offset second -11,0
    set grid

    if (pilotnum==1) {
      plot pilot_slots_1_dat using 1:($2+1.0) title '' with lines ls 104 , \
           slotnum_1                          title '' with lines ls 105 , \
           pilot_queue_1_dat using 1:($2+0.3) title '' with steps ls 104 axes x1y2
    }
    if (pilotnum==2) {
      plot pilot_slots_1_dat using 1:($2-0.2) title '' with lines ls 104 , \
           slotnum_1                          title '' with lines ls 105 , \
           pilot_queue_1_dat using 1:($2+0.0) title '' with steps ls 104 axes x1y2, \
           pilot_slots_2_dat using 1:($2+0.2) title '' with lines ls 204 , \
           slotnum_2                          title '' with lines ls 205 , \
           pilot_queue_2_dat using 1:($2+0.3) title '' with steps ls 204 axes x1y2
    }
    if (pilotnum==3) {
      plot pilot_slots_1_dat using 1:($2-0.3) title '' with lines ls 104 , \
           slotnum_1                          title '' with lines ls 105 , \
           pilot_queue_1_dat using 1:($2+0.0) title '' with steps ls 104 axes x1y2, \
           pilot_slots_2_dat using 1:($2+0.0) title '' with lines ls 204 , \
           slotnum_2                          title '' with lines ls 205 , \
           pilot_queue_2_dat using 1:($2+0.2) title '' with steps ls 204 axes x1y2, \
           pilot_slots_3_dat using 1:($2+0.0) title '' with lines ls 304 , \
           slotnum_3                          title '' with lines ls 305 , \
           pilot_queue_3_dat using 1:($2+0.4) title '' with steps ls 304 axes x1y2
    }

    # ------------------------------------------------------------------------------------
    # Key plot
    set   tmargin 7
    set   lmargin 24
    set   border  lw 0
    unset tics
    unset xlabel
    set   ylabel ""# "Legend and\nStatistics" offset second -17,0
    set   yrange [0:1]
    if (pilotnum==1) {
      set  key center left reverse
      plot NaN lw   0 t 'PILOT 1 ('.pilot_1_name.'):'                      , \
           NaN ls 100 t 'pilot/unit states recorded by RP agent'           , \
           NaN ls 101 t 'pilot/unit states notified to application'        , \
           NaN ls 104 t 'busy slot (i.e. used CPU core)'
    }
    if (pilotnum==2) {
      set   key top left reverse maxrows 4
      plot NaN lw   0 t 'PILOT 1 ('.pilot_1_name.'):'                      , \
           NaN ls 100 t 'pilot/unit states recorded by RP agent'           , \
           NaN ls 101 t 'pilot/unit states notified to application   '     , \
           NaN ls 104 t 'busy slot (i.e. used CPU core)'                   , \
           NaN lw   0 t 'PILOT 2 ('.pilot_2_name.'):'                      , \
           NaN ls 200 t 'pilot/unit states recorded by RP agent'           , \
           NaN ls 201 t 'pilot/unit states notified to application'        , \
           NaN ls 204 t 'busy slot (i.e. used CPU core)'
    }
    if (pilotnum==3) {
      set   key top left reverse maxrows 9
      plot NaN lw   0 t 'PILOT 1 ('.pilot_1_name.'):'                      , \
           NaN ls 100 t 'pilot/unit states recorded by RP agent'           , \
           NaN ls 101 t 'pilot/unit states notified to application   '     , \
           NaN ls 104 t 'busy slot (i.e. used CPU core)'                   , \
           NaN lw   0 t ' '                                                , \
           NaN lw   0 t 'PILOT 2 ('.pilot_2_name.'):'                      , \
           NaN ls 200 t 'pilot/unit states recorded by RP agent'           , \
           NaN ls 201 t 'pilot/unit states notified to application'        , \
           NaN ls 204 t 'busy slot (i.e. used CPU core)'                   , \
           NaN lw   0 t 'PILOT 3 ('.pilot_3_name.'):'                      , \
           NaN ls 300 t 'pilot/unit states recorded by RP agent'           , \
           NaN ls 301 t 'pilot/unit states notified to application'        , \
           NaN ls 304 t 'busy slot (i.e. used CPU core)'                   , \
           NaN lw   0 t ' '                                                , \
           NaN lw   0 t ' '                                                , \
           NaN lw   0 t ' '                                                , \
           NaN lw   0 t ' '
    }
    # ------------------------------------------------------------------------------------

    unset multiplot
    # ------------------------------------------------------------------------------------

}

# ------------------------------------------------------------------------------
# vim: ft=gnuplot


increase graph height

increase graph height

#!/usr/bin/env gnuplot

# graph of CPU temperature

# datafiles
ifnameh = "/tmp/lnxdiagd/mysql4gnuplot/sql11h.csv"
ifnamed = "/tmp/lnxdiagd/mysql4gnuplot/sql11d.csv"
ifnamew = "/tmp/lnxdiagd/mysql4gnuplot/sql11w.csv"
ifnamey = "/tmp/lnxdiagd/mysql4gnuplot/sql11y.csv"
set output "/tmp/lnxdiagd/site/img/day11.png"

# ******************************************************* General settings *****
set terminal png truecolor enhanced font "Vera,9" size 1280,640
set style fill transparent solid 0.25 noborder
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid front
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
if (GPVAL_VERSION == 4.6) {epoch_compensate = 946684800} else {if (GPVAL_VERSION == 5.0) {epoch_compensate = 0}}
# Positions of split between graphs
LMARG = 0.06
LMPOS = 0.40
MRPOS = 0.73
RMARG = 0.94
TTPOS = 0.95
TBPOS = 0.55
BTPOS = 0.48
BBPOS = 0.08

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 1 name "X" nooutput

Xh_min = X_min + utc_offset - epoch_compensate
Xh_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnameh using 2 name "Yh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 1 name "X" nooutput

Xd_min = X_min + utc_offset - epoch_compensate
Xd_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnamed using 3 name "Yd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 1 name "X" nooutput
Xw_min = X_min + utc_offset - epoch_compensate
Xw_max = X_max + utc_offset - epoch_compensate

# stats for Y-axis
stats ifnamew using 4 name "Yw" nooutput

Ymax = max(max(Yd_max, Yh_max), Yw_max) +1
Ymin = min(min(Yd_min, Yh_min), Yw_min) -1

# ********************************************************* Statistics (Y) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamey using 1 name "X" nooutput
Xy_min = X_min + utc_offset - epoch_compensate
Xy_max = X_max + utc_offset - epoch_compensate

set multiplot layout 2, 3 title "CPU Temperature ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                  UPPER ROW
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set tmargin at screen TTPOS
set bmargin at screen TBPOS
set lmargin at screen LMARG
set rmargin at screen RMARG

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xy_min : Xy_max ]

# ***************************************************************** Y-axis *****
set ylabel "Temperature [degC]"
set yrange [ : ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# ***** PLOT *****
plot ifnamey \
      using ($1+utc_offset):2:4 with filledcurves lc rgb "#bb0000" \
  ,'' using ($1+utc_offset):3 with points pt 5 ps 0.2 fc rgb "#bb0000"

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                  LOWER ROW
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Temperature [degC]"
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "red" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set tmargin at screen BTPOS
set bmargin at screen BBPOS
set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($1+utc_offset):2:4 notitle with filledcurves lc rgb "#bb0000" \
  ,'' using ($1+utc_offset):3 title " Temperature [degC]" with lines lw 0.1 fc rgb "#bb0000"

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($1+utc_offset):2:4 with filledcurves lc rgb "#bb0000" \
  ,'' using ($1+utc_offset):3 with points pt 5 ps 0.2 fc rgb "#bb0000"

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($1+utc_offset):2 with points pt 5 ps 0.2 fc rgb "#bb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot

#!/usr/bin/env gnuplot

# graph of CPU temperature

# datafiles
ifnameh = "/tmp/lnxdiagd/mysql4gnuplot/sql11h.csv"
ifnamed = "/tmp/lnxdiagd/mysql4gnuplot/sql11d.csv"
ifnamew = "/tmp/lnxdiagd/mysql4gnuplot/sql11w.csv"
ifnamey = "/tmp/lnxdiagd/mysql4gnuplot/sql11y.csv"
set output "/tmp/lnxdiagd/site/img/day11.png"

# ******************************************************* General settings *****
set terminal png truecolor enhanced font "Vera,9" size 1280,320
set style fill transparent solid 0.25 noborder
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid front
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
if (GPVAL_VERSION == 4.6) {epoch_compensate = 946684800} else {if (GPVAL_VERSION == 5.0) {epoch_compensate = 0}}
# Positions of split between graphs
LMARG = 0.06
LMPOS = 0.40
MRPOS = 0.73
RMARG = 0.94
TTPOS = 0.95
TBPOS = 0.55
BTPOS = 0.48
BBPOS = 0.08

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 1 name "X" nooutput

Xh_min = X_min + utc_offset - epoch_compensate
Xh_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnameh using 2 name "Yh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 1 name "X" nooutput

Xd_min = X_min + utc_offset - epoch_compensate
Xd_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnamed using 3 name "Yd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 1 name "X" nooutput
Xw_min = X_min + utc_offset - epoch_compensate
Xw_max = X_max + utc_offset - epoch_compensate

# stats for Y-axis
stats ifnamew using 4 name "Yw" nooutput

Ymax = max(max(Yd_max, Yh_max), Yw_max) +1
Ymin = min(min(Yd_min, Yh_min), Yw_min) -1

# ********************************************************* Statistics (Y) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamey using 1 name "X" nooutput
Xy_min = X_min + utc_offset - epoch_compensate
Xy_max = X_max + utc_offset - epoch_compensate

set multiplot layout 2, 3 title "CPU Temperature ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                  UPPER ROW
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set tmargin at screen TTPOS
set bmargin at screen TBPOS
set lmargin at screen LMARG
set rmargin at screen RMARG

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xy_min : Xy_max ]

# ***************************************************************** Y-axis *****
set ylabel "Temperature [degC]"
set yrange [ : ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# ***** PLOT *****
plot ifnamey \
      using ($1+utc_offset):2:4 with filledcurves lc rgb "#bb0000" \
  ,'' using ($1+utc_offset):3 with points pt 5 ps 0.2 fc rgb "#bb0000"

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                  LOWER ROW
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Temperature [degC]"
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "red" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set tmargin at screen BTPOS
set bmargin at screen BBPOS
set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($1+utc_offset):2:4 notitle with filledcurves lc rgb "#bb0000" \
  ,'' using ($1+utc_offset):3 title " Temperature [degC]" with lines lw 0.1 fc rgb "#bb0000"

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($1+utc_offset):2:4 with filledcurves lc rgb "#bb0000" \
  ,'' using ($1+utc_offset):3 with points pt 5 ps 0.2 fc rgb "#bb0000"

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($1+utc_offset):2 with points pt 5 ps 0.2 fc rgb "#bb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot


Y-scaling fix

Y-scaling fix

#!/usr/bin/env gnuplot

# graph of UPS available run time

# datafiles
ifnameh = "/tmp/upsdiagd/mysql/upsh.csv"
ifnamed = "/tmp/upsdiagd/mysql/upsd.csv"
ifnamew = "/tmp/upsdiagd/mysql/upsw.csv"
set output "/tmp/upsdiagd/site/img/ups17.png"

# ******************************************************* General settings *****
set terminal png enhanced font "Vera,9" size 1280,320
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
if (GPVAL_VERSION == 4.6) {epoch_compensate = 946684800} else {if (GPVAL_VERSION == 5.0) {epoch_compensate = 0}}
# Positions of split between graphs
LMARG = 0.06
LMPOS = 0.40
MRPOS = 0.73
RMARG = 0.94

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 2 name "X" nooutput

Xh_min = X_min + utc_offset - epoch_compensate
Xh_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnameh using 7 name "Yh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 2 name "X" nooutput

Xd_min = X_min + utc_offset - epoch_compensate
Xd_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnamed using 7 name "Yd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 2 name "X" nooutput
Xw_min = X_min + utc_offset - epoch_compensate
Xw_max = X_max + utc_offset - epoch_compensate

# stats for Y-axis
stats ifnamew using 7 name "Yw" nooutput

Ymax = max(max(Yd_max, Yh_max), Yw_max) + 10
Ymin = min(min(Yd_min, Yh_min), Yw_min) - 10

set multiplot layout 1, 3 title "Beschikbaarheid ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Tijd [s]"
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "red" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($2+utc_offset):7 title " Tijd [s]" with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($2+utc_offset):7 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($2+utc_offset):7 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot

#!/usr/bin/env gnuplot

# graph of UPS available run time

# datafiles
ifnameh = "/tmp/upsdiagd/mysql/upsh.csv"
ifnamed = "/tmp/upsdiagd/mysql/upsd.csv"
ifnamew = "/tmp/upsdiagd/mysql/upsw.csv"
set output "/tmp/upsdiagd/site/img/ups17.png"

# ******************************************************* General settings *****
set terminal png enhanced font "Vera,9" size 1280,320
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
if (GPVAL_VERSION == 4.6) {epoch_compensate = 946684800} else {if (GPVAL_VERSION == 5.0) {epoch_compensate = 0}}
# Positions of split between graphs
LMARG = 0.06
LMPOS = 0.40
MRPOS = 0.73
RMARG = 0.94

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 2 name "X" nooutput

Xh_min = X_min + utc_offset - epoch_compensate
Xh_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnameh using 7 name "Yh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 2 name "X" nooutput

Xd_min = X_min + utc_offset - epoch_compensate
Xd_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnamed using 7 name "Yd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 2 name "X" nooutput
Xw_min = X_min + utc_offset - epoch_compensate
Xw_max = X_max + utc_offset - epoch_compensate

# stats for Y-axis
stats ifnamew using 7 name "Yw" nooutput

Ymax = max(max(Yd_max, Yh_max), Yw_max)
Ymin = min(min(Yd_min, Yh_min), Yw_min)
R10 = (Ymax - Ymin) * 0.1
Ymax = Ymax + R10
Ymin = Ymin - R10

set multiplot layout 1, 3 title "Beschikbaarheid ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Tijd [s]"
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "red" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($2+utc_offset):7 title " Tijd [s]" with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($2+utc_offset):7 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($2+utc_offset):7 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot


Clarify tests (last one failed on newer SWI).

:- include(misc(common)).

:- begin_tests('bson_bits:float_bytes/2').

test('float, bad input, result undefined', [true(Got \== Expected)]) :-
    Expected = bad(input),
    bson_bits:float_bytes(Expected, Bytes),
    bson_bits:float_bytes(Got,      Bytes).

test('float, not a float', [true(Got \== Expected)]) :-
    Expected = 0,
    bson_bits:float_bytes(Expected, Bytes),
    bson_bits:float_bytes(Got,      Bytes).

test('float, zero', [true(Got == Expected)]) :-
    Expected = 0.0,
    bson_bits:float_bytes(Expected, Bytes),
    bson_bits:float_bytes(Got,      Bytes).

test('float, -5.05', [true(Got == Expected)]) :-
    Expected = -5.05,
    bson_bits:float_bytes(Expected, Bytes),
    bson_bits:float_bytes(Got,      Bytes).

test('float, 5.05', [true(Got == Expected)]) :-
    Expected = 5.05,
    bson_bits:float_bytes(Expected, Bytes),
    bson_bits:float_bytes(Got,      Bytes).

test('float, pi', [true(Got == Expected)]) :-
    Expected is 3.14159,
    bson_bits:float_bytes(Expected, Bytes),
    bson_bits:float_bytes(Got,      Bytes).

:- end_tests('bson_bits:float_bytes/2').

:- begin_tests('bson_bits:integer_bytes/4').

test('32-bit, bad input, result undefined', [true(Got \== Expected)]) :-
    Expected = bad(input),
    bson_bits:integer_bytes(Expected, 4, big, Bytes),
    bson_bits:integer_bytes(Got,      4, big, Bytes).

test('32-bit big-endian, zero', [true(Got == Expected)]) :-
    Expected = 0,
    bson_bits:integer_bytes(Expected, 4, big, Bytes),
    bson_bits:integer_bytes(Got,      4, big, Bytes).

test('32-bit big-endian, -1', [true(Got == Expected)]) :-
    Expected = -1,
    bson_bits:integer_bytes(Expected, 4, big, Bytes),
    bson_bits:integer_bytes(Got,      4, big, Bytes).

test('32-bit big-endian, 1', [true(Got == Expected)]) :-
    Expected = 1,
    bson_bits:integer_bytes(Expected, 4, big, Bytes),
    bson_bits:integer_bytes(Got,      4, big, Bytes).

test('32-bit big-endian, verify endian', [true(Got == Expected)]) :-
    Expected = [0,0,0,1],
    bson_bits:integer_bytes(1, 4, big, Got).

test('32-bit big-endian, min', [true(Got == Expected)]) :-
    Expected is -2**31,
    bson_bits:integer_bytes(Expected, 4, big, Bytes),
    bson_bits:integer_bytes(Got,      4, big, Bytes).

test('32-bit big-endian, min-1', [true(Got \== Expected)]) :-
    Expected is -2**31 - 1, % Too low.
    bson_bits:integer_bytes(Expected, 4, big, Bytes),
    bson_bits:integer_bytes(Got,      4, big, Bytes).

test('32-bit big-endian, max', [true(Got == Expected)]) :-
    Expected is 2**31 - 1,
    bson_bits:integer_bytes(Expected, 4, big, Bytes),
    bson_bits:integer_bytes(Got,      4, big, Bytes).

test('32-bit big-endian, max+1', [true(Got \== Expected)]) :-
    Expected is 2**31, % Too high.
    bson_bits:integer_bytes(Expected, 4, big, Bytes),
    bson_bits:integer_bytes(Got,      4, big, Bytes).

% ------------------------------------

test('32-bit little-endian, zero', [true(Got == Expected)]) :-
    Expected = 0,
    bson_bits:integer_bytes(Expected, 4, little, Bytes),
    bson_bits:integer_bytes(Got,      4, little, Bytes).

test('32-bit little-endian, -1', [true(Got == Expected)]) :-
    Expected = -1,
    bson_bits:integer_bytes(Expected, 4, little, Bytes),
    bson_bits:integer_bytes(Got,      4, little, Bytes).

test('32-bit little-endian, 1', [true(Got == Expected)]) :-
    Expected = 1,
    bson_bits:integer_bytes(Expected, 4, little, Bytes),
    bson_bits:integer_bytes(Got,      4, little, Bytes).

test('32-bit little-endian, verify endian', [true(Got == Expected)]) :-
    Expected = [1,0,0,0],
    bson_bits:integer_bytes(1, 4, little, Got).

test('32-bit little-endian, min', [true(Got == Expected)]) :-
    Expected is -2**31,
    bson_bits:integer_bytes(Expected, 4, little, Bytes),
    bson_bits:integer_bytes(Got,      4, little, Bytes).

test('32-bit little-endian, min-1', [true(Got \== Expected)]) :-
    Expected is -2**31 - 1, % Too low.
    bson_bits:integer_bytes(Expected, 4, little, Bytes),
    bson_bits:integer_bytes(Got,      4, little, Bytes).

test('32-bit little-endian, max', [true(Got == Expected)]) :-
    Expected is 2**31 - 1,
    bson_bits:integer_bytes(Expected, 4, little, Bytes),
    bson_bits:integer_bytes(Got,      4, little, Bytes).

test('32-bit little-endian, max+1', [true(Got \== Expected)]) :-
    Expected is 2**31, % Too high.
    bson_bits:integer_bytes(Expected, 4, little, Bytes),
    bson_bits:integer_bytes(Got,      4, little, Bytes).

% ------------------------------------

test('64-bit, bad input, result undefined', [true(Got \== Expected)]) :-
    Expected = bad(input),
    bson_bits:integer_bytes(Expected, 8, big, Bytes),
    bson_bits:integer_bytes(Got,      8, big, Bytes).

test('64-bit big-endian, zero', [true(Got == Expected)]) :-
    Expected = 0,
    bson_bits:integer_bytes(Expected, 8, big, Bytes),
    bson_bits:integer_bytes(Got,      8, big, Bytes).

test('64-bit big-endian, -1', [true(Got == Expected)]) :-
    Expected = -1,
    bson_bits:integer_bytes(Expected, 8, big, Bytes),
    bson_bits:integer_bytes(Got,      8, big, Bytes).

test('64-bit big-endian, 1', [true(Got == Expected)]) :-
    Expected = 1,
    bson_bits:integer_bytes(Expected, 8, big, Bytes),
    bson_bits:integer_bytes(Got,      8, big, Bytes).

test('64-bit big-endian, verify endian', [true(Got == Expected)]) :-
    Expected = [0,0,0,0,0,0,0,1],
    bson_bits:integer_bytes(1, 8, big, Got).

test('64-bit big-endian, min', [true(Got == Expected)]) :-
    Expected is -2**63,
    bson_bits:integer_bytes(Expected, 8, big, Bytes),
    bson_bits:integer_bytes(Got,      8, big, Bytes).

test('64-bit big-endian, min-1', [true(Got \== Expected)]) :-
    Expected is -2**63 - 1, % Too low.
    bson_bits:integer_bytes(Expected, 8, big, Bytes),
    bson_bits:integer_bytes(Got,      8, big, Bytes).

test('64-bit big-endian, max', [true(Got == Expected)]) :-
    Expected is 2**63 - 1,
    bson_bits:integer_bytes(Expected, 8, big, Bytes),
    bson_bits:integer_bytes(Got,      8, big, Bytes).

test('64-bit big-endian, max+1', [true(Got \== Expected)]) :-
    Expected is 2**63, % Too high.
    bson_bits:integer_bytes(Expected, 8, big, Bytes),
    bson_bits:integer_bytes(Got,      8, big, Bytes).

% ------------------------------------

test('64-bit little-endian, zero', [true(Got == Expected)]) :-
    Expected = 0,
    bson_bits:integer_bytes(Expected, 8, little, Bytes),
    bson_bits:integer_bytes(Got,      8, little, Bytes).

test('64-bit little-endian, -1', [true(Got == Expected)]) :-
    Expected = -1,
    bson_bits:integer_bytes(Expected, 8, little, Bytes),
    bson_bits:integer_bytes(Got,      8, little, Bytes).

test('64-bit little-endian, 1', [true(Got == Expected)]) :-
    Expected = 1,
    bson_bits:integer_bytes(Expected, 8, little, Bytes),
    bson_bits:integer_bytes(Got,      8, little, Bytes).

test('64-bit little-endian, verify endian', [true(Got == Expected)]) :-
    Expected = [1,0,0,0,0,0,0,0],
    bson_bits:integer_bytes(1, 8, little, Got).

test('64-bit little-endian, min', [true(Got == Expected)]) :-
    Expected is -2**63,
    bson_bits:integer_bytes(Expected, 8, little, Bytes),
    bson_bits:integer_bytes(Got,      8, little, Bytes).

test('64-bit little-endian, min-1', [true(Got \== Expected)]) :-
    Expected is -2**63 - 1, % Too low.
    bson_bits:integer_bytes(Expected, 8, little, Bytes),
    bson_bits:integer_bytes(Got,      8, little, Bytes).

test('64-bit little-endian, max', [true(Got == Expected)]) :-
    Expected is 2**63 - 1,
    bson_bits:integer_bytes(Expected, 8, little, Bytes),
    bson_bits:integer_bytes(Got,      8, little, Bytes).

test('64-bit little-endian, max+1', [true(Got \== Expected)]) :-
    Expected is 2**63, % Too high.
    bson_bits:integer_bytes(Expected, 8, little, Bytes),
    bson_bits:integer_bytes(Got,      8, little, Bytes).

:- end_tests('bson_bits:integer_bytes/4').

:- begin_tests('bson_bits:hex_bytes/2').

test('hex to bytes, bad input should throw', [throws(_)]) :-
    Expected = bad(input),
    bson_bits:hex_bytes(Expected, _Bytes).

test('hex <-> bytes', [true(Got == Expected)]) :-
    Expected = '47cc67093475061e3d95369d',
    bson_bits:hex_bytes(Expected, Bytes),
    bson_bits:hex_bytes(Got,      Bytes).

test('hex to bytes, verify big endian', [true(Got == Expected)]) :-
    Hex = '47cc6709',
    Expected = [0x47,0xcc,0x67,0x09],
    bson_bits:hex_bytes(Hex, Got).

test('hex to bytes, odd length should fail', [fail]) :-
    HexOddLength = '47c',
    bson_bits:hex_bytes(HexOddLength, _Bytes).

:- end_tests('bson_bits:hex_bytes/2').

:- include(misc(common)).

:- begin_tests('bson_bits:float_bytes/2').

test('float, bad input, result undefined', [true(Got \== Expected)]) :-
    Expected = bad_input,
    bson_bits:float_bytes(Expected, Bytes),
    bson_bits:float_bytes(Got,      Bytes).

test('float, not a float', [true(Got \== Expected)]) :-
    Expected = 0,
    bson_bits:float_bytes(Expected, Bytes),
    bson_bits:float_bytes(Got,      Bytes).

test('float, zero', [true(Got == Expected)]) :-
    Expected = 0.0,
    bson_bits:float_bytes(Expected, Bytes),
    bson_bits:float_bytes(Got,      Bytes).

test('float, -5.05', [true(Got == Expected)]) :-
    Expected = -5.05,
    bson_bits:float_bytes(Expected, Bytes),
    bson_bits:float_bytes(Got,      Bytes).

test('float, 5.05', [true(Got == Expected)]) :-
    Expected = 5.05,
    bson_bits:float_bytes(Expected, Bytes),
    bson_bits:float_bytes(Got,      Bytes).

test('float, pi', [true(Got == Expected)]) :-
    Expected is 3.14159,
    bson_bits:float_bytes(Expected, Bytes),
    bson_bits:float_bytes(Got,      Bytes).

:- end_tests('bson_bits:float_bytes/2').

:- begin_tests('bson_bits:integer_bytes/4').

test('32-bit, bad input, result undefined', [true(Got \== Expected)]) :-
    Expected = bad_input,
    bson_bits:integer_bytes(Expected, 4, big, Bytes),
    bson_bits:integer_bytes(Got,      4, big, Bytes).

test('32-bit big-endian, zero', [true(Got == Expected)]) :-
    Expected = 0,
    bson_bits:integer_bytes(Expected, 4, big, Bytes),
    bson_bits:integer_bytes(Got,      4, big, Bytes).

test('32-bit big-endian, -1', [true(Got == Expected)]) :-
    Expected = -1,
    bson_bits:integer_bytes(Expected, 4, big, Bytes),
    bson_bits:integer_bytes(Got,      4, big, Bytes).

test('32-bit big-endian, 1', [true(Got == Expected)]) :-
    Expected = 1,
    bson_bits:integer_bytes(Expected, 4, big, Bytes),
    bson_bits:integer_bytes(Got,      4, big, Bytes).

test('32-bit big-endian, verify endian', [true(Got == Expected)]) :-
    Expected = [0,0,0,1],
    bson_bits:integer_bytes(1, 4, big, Got).

test('32-bit big-endian, min', [true(Got == Expected)]) :-
    Expected is -2**31,
    bson_bits:integer_bytes(Expected, 4, big, Bytes),
    bson_bits:integer_bytes(Got,      4, big, Bytes).

test('32-bit big-endian, min-1', [true(Got \== Expected)]) :-
    Expected is -2**31 - 1, % Too low.
    bson_bits:integer_bytes(Expected, 4, big, Bytes),
    bson_bits:integer_bytes(Got,      4, big, Bytes).

test('32-bit big-endian, max', [true(Got == Expected)]) :-
    Expected is 2**31 - 1,
    bson_bits:integer_bytes(Expected, 4, big, Bytes),
    bson_bits:integer_bytes(Got,      4, big, Bytes).

test('32-bit big-endian, max+1', [true(Got \== Expected)]) :-
    Expected is 2**31, % Too high.
    bson_bits:integer_bytes(Expected, 4, big, Bytes),
    bson_bits:integer_bytes(Got,      4, big, Bytes).

% ------------------------------------

test('32-bit little-endian, zero', [true(Got == Expected)]) :-
    Expected = 0,
    bson_bits:integer_bytes(Expected, 4, little, Bytes),
    bson_bits:integer_bytes(Got,      4, little, Bytes).

test('32-bit little-endian, -1', [true(Got == Expected)]) :-
    Expected = -1,
    bson_bits:integer_bytes(Expected, 4, little, Bytes),
    bson_bits:integer_bytes(Got,      4, little, Bytes).

test('32-bit little-endian, 1', [true(Got == Expected)]) :-
    Expected = 1,
    bson_bits:integer_bytes(Expected, 4, little, Bytes),
    bson_bits:integer_bytes(Got,      4, little, Bytes).

test('32-bit little-endian, verify endian', [true(Got == Expected)]) :-
    Expected = [1,0,0,0],
    bson_bits:integer_bytes(1, 4, little, Got).

test('32-bit little-endian, min', [true(Got == Expected)]) :-
    Expected is -2**31,
    bson_bits:integer_bytes(Expected, 4, little, Bytes),
    bson_bits:integer_bytes(Got,      4, little, Bytes).

test('32-bit little-endian, min-1', [true(Got \== Expected)]) :-
    Expected is -2**31 - 1, % Too low.
    bson_bits:integer_bytes(Expected, 4, little, Bytes),
    bson_bits:integer_bytes(Got,      4, little, Bytes).

test('32-bit little-endian, max', [true(Got == Expected)]) :-
    Expected is 2**31 - 1,
    bson_bits:integer_bytes(Expected, 4, little, Bytes),
    bson_bits:integer_bytes(Got,      4, little, Bytes).

test('32-bit little-endian, max+1', [true(Got \== Expected)]) :-
    Expected is 2**31, % Too high.
    bson_bits:integer_bytes(Expected, 4, little, Bytes),
    bson_bits:integer_bytes(Got,      4, little, Bytes).

% ------------------------------------

test('64-bit, bad input, result undefined', [true(Got \== Expected)]) :-
    Expected = bad_input,
    bson_bits:integer_bytes(Expected, 8, big, Bytes),
    bson_bits:integer_bytes(Got,      8, big, Bytes).

test('64-bit big-endian, zero', [true(Got == Expected)]) :-
    Expected = 0,
    bson_bits:integer_bytes(Expected, 8, big, Bytes),
    bson_bits:integer_bytes(Got,      8, big, Bytes).

test('64-bit big-endian, -1', [true(Got == Expected)]) :-
    Expected = -1,
    bson_bits:integer_bytes(Expected, 8, big, Bytes),
    bson_bits:integer_bytes(Got,      8, big, Bytes).

test('64-bit big-endian, 1', [true(Got == Expected)]) :-
    Expected = 1,
    bson_bits:integer_bytes(Expected, 8, big, Bytes),
    bson_bits:integer_bytes(Got,      8, big, Bytes).

test('64-bit big-endian, verify endian', [true(Got == Expected)]) :-
    Expected = [0,0,0,0,0,0,0,1],
    bson_bits:integer_bytes(1, 8, big, Got).

test('64-bit big-endian, min', [true(Got == Expected)]) :-
    Expected is -2**63,
    bson_bits:integer_bytes(Expected, 8, big, Bytes),
    bson_bits:integer_bytes(Got,      8, big, Bytes).

test('64-bit big-endian, min-1', [true(Got \== Expected)]) :-
    Expected is -2**63 - 1, % Too low.
    bson_bits:integer_bytes(Expected, 8, big, Bytes),
    bson_bits:integer_bytes(Got,      8, big, Bytes).

test('64-bit big-endian, max', [true(Got == Expected)]) :-
    Expected is 2**63 - 1,
    bson_bits:integer_bytes(Expected, 8, big, Bytes),
    bson_bits:integer_bytes(Got,      8, big, Bytes).

test('64-bit big-endian, max+1', [true(Got \== Expected)]) :-
    Expected is 2**63, % Too high.
    bson_bits:integer_bytes(Expected, 8, big, Bytes),
    bson_bits:integer_bytes(Got,      8, big, Bytes).

% ------------------------------------

test('64-bit little-endian, zero', [true(Got == Expected)]) :-
    Expected = 0,
    bson_bits:integer_bytes(Expected, 8, little, Bytes),
    bson_bits:integer_bytes(Got,      8, little, Bytes).

test('64-bit little-endian, -1', [true(Got == Expected)]) :-
    Expected = -1,
    bson_bits:integer_bytes(Expected, 8, little, Bytes),
    bson_bits:integer_bytes(Got,      8, little, Bytes).

test('64-bit little-endian, 1', [true(Got == Expected)]) :-
    Expected = 1,
    bson_bits:integer_bytes(Expected, 8, little, Bytes),
    bson_bits:integer_bytes(Got,      8, little, Bytes).

test('64-bit little-endian, verify endian', [true(Got == Expected)]) :-
    Expected = [1,0,0,0,0,0,0,0],
    bson_bits:integer_bytes(1, 8, little, Got).

test('64-bit little-endian, min', [true(Got == Expected)]) :-
    Expected is -2**63,
    bson_bits:integer_bytes(Expected, 8, little, Bytes),
    bson_bits:integer_bytes(Got,      8, little, Bytes).

test('64-bit little-endian, min-1', [true(Got \== Expected)]) :-
    Expected is -2**63 - 1, % Too low.
    bson_bits:integer_bytes(Expected, 8, little, Bytes),
    bson_bits:integer_bytes(Got,      8, little, Bytes).

test('64-bit little-endian, max', [true(Got == Expected)]) :-
    Expected is 2**63 - 1,
    bson_bits:integer_bytes(Expected, 8, little, Bytes),
    bson_bits:integer_bytes(Got,      8, little, Bytes).

test('64-bit little-endian, max+1', [true(Got \== Expected)]) :-
    Expected is 2**63, % Too high.
    bson_bits:integer_bytes(Expected, 8, little, Bytes),
    bson_bits:integer_bytes(Got,      8, little, Bytes).

:- end_tests('bson_bits:integer_bytes/4').

:- begin_tests('bson_bits:hex_bytes/2').

test('hex to bytes, bad input should throw', [throws(_)]) :-
    Expected = bad_input,
    bson_bits:hex_bytes(Expected, _Bytes).

test('hex <-> bytes', [true(Got == Expected)]) :-
    Expected = '47cc67093475061e3d95369d',
    bson_bits:hex_bytes(Expected, Bytes),
    bson_bits:hex_bytes(Got,      Bytes).

test('hex to bytes, verify big endian', [true(Got == Expected)]) :-
    Hex = '47cc6709',
    Expected = [0x47,0xcc,0x67,0x09],
    bson_bits:hex_bytes(Hex, Got).

test('hex to bytes, odd length should fail', [fail]) :-
    HexOddLength = '47c',
    bson_bits:hex_bytes(HexOddLength, _Bytes).

:- end_tests('bson_bits:hex_bytes/2').


Set min y as 0

Set min y as 0

# Note you need gnuplot 4.4 for the pdfcairo terminal.

# set terminal pdfcairo font "Gill Sans,9" linewidth 4 rounded fontscale 1.0
set terminal pdfcairo font "Gill Sans,7" linewidth 1 rounded fontscale 1.0

# Line style for axes
set style line 80 lt rgb "#808080"

# Line style for grid
set style line 81 lt 0  # dashed
set style line 81 lt rgb "#808080"  # grey

set grid back linestyle 81
set border 3 back linestyle 80 # Remove border on top and right.  These
             # borders are useless and make it harder
             # to see plotted lines near the border.
    # Also, put it in grey; no need for so much emphasis on a border.
# set xtics nomirror
# set ytics nomirror

#set log x
#set mxtics 10    # Makes logscale look good.

# Line styles: try to pick pleasing colors, rather
# than strictly primary colors or hard-to-see colors

# like gnuplot's default yellow.  Make the lines thick
# so they're easy to see in small plots in papers.
set style line 1 lc rgb "#A00000" lw 2 pt 7 ps 0.5
set style line 2 lc rgb "#00A000" lw 2 pt 7 ps 0.5
set style line 3 lc rgb "#5060D0" lw 2 pt 7 ps 0.5
set style line 4 lc rgb "#F25900" lw 2 pt 7 ps 0.5
# Let gnuplot decide the color, if more than 4 lines
set style line 5 lw 2 pt 7 ps 0.5
set style line 6 lw 2 pt 7 ps 0.5
set style line 7 lw 2 pt 7 ps 0.5
set style line 8 lw 2 pt 7 ps 0.5

#
set object circle at first convergence_time,0 radius char 0.8 fillcolor rgb "#ffbf00" fillstyle solid noborder

set output outputname
set xlabel "Time in Seconds"
set ylabel "MB Transmitted"

set key bottom right

set datafile missing '0'

# log scale on the y axis
# set logscale y 2
# set format y ""
# set ytics 1e-6, 10, 1
# set ytics add ("1" 1, ".1" 0.1, ".01" 0.01, "10^-3" 0.001, \
#                "10^-4" 0.0001)
# set mytics 10

set yrange [0:*]

# set xrange [0:60]
# set yrange [0.5:64]

# Titles with spaces are not allowed
# These titles should be separated by "_" and here we replace by " "
pretty(title) = system("echo ".title." | sed 's/_/ /g'")

# Input file contains comma-separated values fields
set datafile separator ","

plot for [i=0:words(inputnames) - 1] word(inputnames, i + 1) using 1:2 title pretty(word(titles, i + 1)) with linespoints ls i + 1

# Note you need gnuplot 4.4 for the pdfcairo terminal.

# set terminal pdfcairo font "Gill Sans,9" linewidth 4 rounded fontscale 1.0
set terminal pdfcairo font "Gill Sans,7" linewidth 1 rounded fontscale 1.0

# Line style for axes
set style line 80 lt rgb "#808080"

# Line style for grid
set style line 81 lt 0  # dashed
set style line 81 lt rgb "#808080"  # grey

set grid back linestyle 81
set border 3 back linestyle 80 # Remove border on top and right.  These
             # borders are useless and make it harder
             # to see plotted lines near the border.
    # Also, put it in grey; no need for so much emphasis on a border.
# set xtics nomirror
# set ytics nomirror

#set log x
#set mxtics 10    # Makes logscale look good.

# Line styles: try to pick pleasing colors, rather
# than strictly primary colors or hard-to-see colors

# like gnuplot's default yellow.  Make the lines thick
# so they're easy to see in small plots in papers.
set style line 1 lc rgb "#A00000" lw 2 pt 7 ps 0.5
set style line 2 lc rgb "#00A000" lw 2 pt 7 ps 0.5
set style line 3 lc rgb "#5060D0" lw 2 pt 7 ps 0.5
set style line 4 lc rgb "#F25900" lw 2 pt 7 ps 0.5
# Let gnuplot decide the color, if more than 4 lines
set style line 5 lw 2 pt 7 ps 0.5
set style line 6 lw 2 pt 7 ps 0.5
set style line 7 lw 2 pt 7 ps 0.5
set style line 8 lw 2 pt 7 ps 0.5

#
set object circle at first convergence_time,0 radius char 0.8 fillcolor rgb "#ffbf00" fillstyle solid noborder

set output outputname
set xlabel "Time in Seconds"
set ylabel "MB Transmitted"

set key bottom right

set datafile missing '0'

# log scale on the y axis
# set logscale y 2
# set format y ""
# set ytics 1e-6, 10, 1
# set ytics add ("1" 1, ".1" 0.1, ".01" 0.01, "10^-3" 0.001, \
#                "10^-4" 0.0001)
# set mytics 10

# set xrange [0:60]
# set yrange [0.5:64]

# Titles with spaces are not allowed
# These titles should be separated by "_" and here we replace by " "
pretty(title) = system("echo ".title." | sed 's/_/ /g'")

# Input file contains comma-separated values fields
set datafile separator ","

plot for [i=0:words(inputnames) - 1] word(inputnames, i + 1) using 1:2 title pretty(word(titles, i + 1)) with linespoints ls i + 1