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 106 lt 1 lc rgb '#AA6666' pt 7 ps term_mult*0.6 lw term_mult*2

    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 206 lt 1 lc rgb '#66AA66' pt 7 ps term_mult*0.6 lw term_mult*2

    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 style line 306 lt 1 lc rgb '#6666AA' pt 7 ps term_mult*0.6 lw term_mult*2

  # 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 steps  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 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 , \
             pilot_states_3_dat    using 1:($2-0.1) title '' with steps  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 / 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 106 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 106 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 206 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 106 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 206 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 306 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)'                   , \
           NaN ls 105 t 'total number of slots'                            , \
           NaN ls 106 t 'unit queue length'                                , \
           NaN lw   0 t ' '
    }
    if (pilotnum==2) {
      set   key top left reverse maxrows 7
      plot NaN lw   0 with steps  t 'PILOT 1 ('.pilot_1_name.'):'                      , \
           NaN ls 100 with steps  t 'pilot/unit states recorded by RP agent'           , \
           NaN ls 101 with points t 'pilot/unit states notified to application   '     , \
           NaN ls 104 with steps  t 'busy slot (i.e. used CPU core)'                   , \
           NaN ls 105 with steps  t 'total number of slots'                            , \
           NaN ls 106 with steps  t 'unit queue length'                                , \
           NaN lw   0 with steps  t ' '                                                , \
           NaN lw   0 with steps  t 'PILOT 2 ('.pilot_2_name.'):'                      , \
           NaN ls 200 with steps  t 'pilot/unit states recorded by RP agent'           , \
           NaN ls 201 with steps  t 'pilot/unit states notified to application'        , \
           NaN ls 204 with steps  t 'busy slot (i.e. used CPU core)'                   , \
           NaN ls 205 with steps  t 'total number of slots'                            , \
           NaN ls 206 with steps  t 'unit queue length'                                , \
           NaN lw   0 with steps  t ' '
    }
    if (pilotnum==3) {
      set   key top left reverse maxrows 14
      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 ls 105 t 'total number of slots'                            , \
           NaN ls 106 t 'unit queue length'                                , \
           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 ls 205 t 'total number of slots'                            , \
           NaN ls 206 t 'unit queue length'                                , \
           NaN lw   0 t ' '                                                , \
           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 ls 305 t 'total number of slots'                            , \
           NaN ls 306 t 'unit queue length'                                , \
           NaN lw   0 t ' '                                                , \
           NaN lw   0 t ' '                                                , \
           NaN lw   0 t ' '                                                , \
           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  = 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


align production graph

align production graph


Since we are collecting all of this data, we might as well graph it!

git-svn-id: a4a6f32337ebd29ad4763b423022f00f68d1c7b7@9807 91177308-0d34-0410-b5e6-96231b3b80d8

set terminal png

##------- Plot small Date vs LOC ----
set output "running_loc.png"
set xlabel "Date"
set ylabel "Lines of Code"
set xdata time
set timefmt "%Y-%m-%d:"
set format x "%b %d, %Y"

## Various labels for the graph
set label "Reoptimizer\n checkins" at "2003-02-18:", 114000
set label "Modulo Sched\n   checkin" at "2003-03-28:", 119500
set label "Reoptimizer\n checkins" at "2003-06-01:", 134000
set label "'dummy'\nfunction" at "2003-07-20:", 150000
set label "Reoptimizer\n removal" at "2003-08-10:", 132000

set size .75,.75
plot "running_loc.txt" using 1:2 title '' with lines, \
     "running_loc.txt" using 1:2 title "Date vs. Lines of Code" with lines

##------- Plot large Date vs LOC ----
set size 1.5,1.5
set output "running_loc_large.png"
plot "running_loc.txt" using 1:2 title '', \
     "running_loc.txt" using 1:2 title "Date vs. Lines of Code" with lines

# Delete all labels...
set nolabel

##------- Olden CBE performance ----

set size .75,.75
set output "running_Olden_cbe_time.png"
set ylabel "CBE compiled execution time"
plot "running_Olden_cbe_time.txt" u 1:2 t '' with lines, \
     "running_Olden_cbe_time.txt" u 1:2 t "bh" with lines, \
     "running_Olden_cbe_time.txt" u 1:3 t "bisort" with lines, \
     "running_Olden_cbe_time.txt" u 1:4 t "em3d" with lines, \
     "running_Olden_cbe_time.txt" u 1:5 t "health" with lines, \
     "running_Olden_cbe_time.txt" u 1:6 t "mst" with lines, \
     "running_Olden_cbe_time.txt" u 1:7 t "perimeter" with lines, \
     "running_Olden_cbe_time.txt" u 1:8 t "power" with lines, \
     "running_Olden_cbe_time.txt" u 1:9 t "treeadd" with lines, \
     "running_Olden_cbe_time.txt" u 1:10 t "tsp" with lines, \
     "running_Olden_cbe_time.txt" u 1:11 t "voronoi" \
   with lines

set size 1.5,1.5
set output "running_Olden_cbe_time_large.png"
plot "running_Olden_cbe_time.txt" u 1:2 t '' with lines, \
     "running_Olden_cbe_time.txt" u 1:2 t "bh" with lines, \
     "running_Olden_cbe_time.txt" u 1:3 t "bisort" with lines, \
     "running_Olden_cbe_time.txt" u 1:4 t "em3d" with lines, \
     "running_Olden_cbe_time.txt" u 1:5 t "health" with lines, \
     "running_Olden_cbe_time.txt" u 1:6 t "mst" with lines, \
     "running_Olden_cbe_time.txt" u 1:7 t "perimeter" with lines, \
     "running_Olden_cbe_time.txt" u 1:8 t "power" with lines, \
     "running_Olden_cbe_time.txt" u 1:9 t "treeadd" with lines, \
     "running_Olden_cbe_time.txt" u 1:10 t "tsp" with lines, \
     "running_Olden_cbe_time.txt" u 1:11 t "voronoi" \
   with lines

##------- Olden JIT performance ----

set size .75,.75
set output "running_Olden_jit_time.png"
set ylabel "JIT execution time"
plot "running_Olden_jit_time.txt" u 1:2 t '' with lines, \
     "running_Olden_jit_time.txt" u 1:2 t "bh" with lines, \
     "running_Olden_jit_time.txt" u 1:3 t "bisort" with lines, \
     "running_Olden_jit_time.txt" u 1:4 t "em3d" with lines, \
     "running_Olden_jit_time.txt" u 1:5 t "health" with lines, \
     "running_Olden_jit_time.txt" u 1:6 t "mst" with lines, \
     "running_Olden_jit_time.txt" u 1:7 t "perimeter" with lines, \
     "running_Olden_jit_time.txt" u 1:8 t "power" with lines, \
     "running_Olden_jit_time.txt" u 1:9 t "treeadd" with lines, \
     "running_Olden_jit_time.txt" u 1:10 t "tsp" with lines, \
     "running_Olden_jit_time.txt" u 1:11 t "voronoi" \
   with lines

set size 1.5,1.5
set output "running_Olden_jit_time_large.png"
plot "running_Olden_jit_time.txt" u 1:2 t '' with lines, \
     "running_Olden_jit_time.txt" u 1:2 t "bh" with lines, \
     "running_Olden_jit_time.txt" u 1:3 t "bisort" with lines, \
     "running_Olden_jit_time.txt" u 1:4 t "em3d" with lines, \
     "running_Olden_jit_time.txt" u 1:5 t "health" with lines, \
     "running_Olden_jit_time.txt" u 1:6 t "mst" with lines, \
     "running_Olden_jit_time.txt" u 1:7 t "perimeter" with lines, \
     "running_Olden_jit_time.txt" u 1:8 t "power" with lines, \
     "running_Olden_jit_time.txt" u 1:9 t "treeadd" with lines, \
     "running_Olden_jit_time.txt" u 1:10 t "tsp" with lines, \
     "running_Olden_jit_time.txt" u 1:11 t "voronoi" \
   with lines

##------- Olden LLC performance ----

set size .75,.75
set output "running_Olden_llc_time.png"
set ylabel "LLC compiled execution time"
plot "running_Olden_llc_time.txt" u 1:2 t '' with lines, \
     "running_Olden_llc_time.txt" u 1:2 t "bh" with lines, \
     "running_Olden_llc_time.txt" u 1:3 t "bisort" with lines, \
     "running_Olden_llc_time.txt" u 1:4 t "em3d" with lines, \
     "running_Olden_llc_time.txt" u 1:5 t "health" with lines, \
     "running_Olden_llc_time.txt" u 1:6 t "mst" with lines, \
     "running_Olden_llc_time.txt" u 1:7 t "perimeter" with lines, \
     "running_Olden_llc_time.txt" u 1:8 t "power" with lines, \
     "running_Olden_llc_time.txt" u 1:9 t "treeadd" with lines, \
     "running_Olden_llc_time.txt" u 1:10 t "tsp" with lines, \
     "running_Olden_llc_time.txt" u 1:11 t "voronoi" \
   with lines

set size 1.5,1.5
set output "running_Olden_llc_time_large.png"
plot "running_Olden_llc_time.txt" u 1:2 t '' with lines, \
     "running_Olden_llc_time.txt" u 1:2 t "bh" with lines, \
     "running_Olden_llc_time.txt" u 1:3 t "bisort" with lines, \
     "running_Olden_llc_time.txt" u 1:4 t "em3d" with lines, \
     "running_Olden_llc_time.txt" u 1:5 t "health" with lines, \
     "running_Olden_llc_time.txt" u 1:6 t "mst" with lines, \
     "running_Olden_llc_time.txt" u 1:7 t "perimeter" with lines, \
     "running_Olden_llc_time.txt" u 1:8 t "power" with lines, \
     "running_Olden_llc_time.txt" u 1:9 t "treeadd" with lines, \
     "running_Olden_llc_time.txt" u 1:10 t "tsp" with lines, \
     "running_Olden_llc_time.txt" u 1:11 t "voronoi" \
   with lines

##------- Olden optimizer time ----

set size .75,.75
set output "running_Olden_opt_time.png"
set ylabel "Time to run the optimizer"
plot "running_Olden_opt_time.txt" u 1:2 t '' with lines, \
     "running_Olden_opt_time.txt" u 1:2 t "bh" with lines, \
     "running_Olden_opt_time.txt" u 1:3 t "bisort" with lines, \
     "running_Olden_opt_time.txt" u 1:4 t "em3d" with lines, \
     "running_Olden_opt_time.txt" u 1:5 t "health" with lines, \
     "running_Olden_opt_time.txt" u 1:6 t "mst" with lines, \
     "running_Olden_opt_time.txt" u 1:7 t "perimeter" with lines, \
     "running_Olden_opt_time.txt" u 1:8 t "power" with lines, \
     "running_Olden_opt_time.txt" u 1:9 t "treeadd" with lines, \
     "running_Olden_opt_time.txt" u 1:10 t "tsp" with lines, \
     "running_Olden_opt_time.txt" u 1:11 t "voronoi" \
   with lines

set size 1.5,1.5
set output "running_Olden_opt_time_large.png"
plot "running_Olden_opt_time.txt" u 1:2 t '' with lines, \
     "running_Olden_opt_time.txt" u 1:2 t "bh" with lines, \
     "running_Olden_opt_time.txt" u 1:3 t "bisort" with lines, \
     "running_Olden_opt_time.txt" u 1:4 t "em3d" with lines, \
     "running_Olden_opt_time.txt" u 1:5 t "health" with lines, \
     "running_Olden_opt_time.txt" u 1:6 t "mst" with lines, \
     "running_Olden_opt_time.txt" u 1:7 t "perimeter" with lines, \
     "running_Olden_opt_time.txt" u 1:8 t "power" with lines, \
     "running_Olden_opt_time.txt" u 1:9 t "treeadd" with lines, \
     "running_Olden_opt_time.txt" u 1:10 t "tsp" with lines, \
     "running_Olden_opt_time.txt" u 1:11 t "voronoi" \
   with lines

##------- Machine code size ----

set size .75,.75
set output "running_Olden_machcode.png"
set ylabel "Program machine code size"
plot "running_Olden_machcode.txt" u 1:2 t '' with lines, \
     "running_Olden_machcode.txt" u 1:2 t "bh" with lines, \
     "running_Olden_machcode.txt" u 1:3 t "bisort" with lines, \
     "running_Olden_machcode.txt" u 1:4 t "em3d" with lines, \
     "running_Olden_machcode.txt" u 1:5 t "health" with lines, \
     "running_Olden_machcode.txt" u 1:6 t "mst" with lines, \
     "running_Olden_machcode.txt" u 1:7 t "perimeter" with lines, \
     "running_Olden_machcode.txt" u 1:8 t "power" with lines, \
     "running_Olden_machcode.txt" u 1:9 t "treeadd" with lines, \
     "running_Olden_machcode.txt" u 1:10 t "tsp" with lines, \
     "running_Olden_machcode.txt" u 1:11 t "voronoi" \
   with lines

set size 1.5,1.5
set output "running_Olden_machcode_large.png"
plot "running_Olden_machcode.txt" u 1:2 t '' with lines, \
     "running_Olden_machcode.txt" u 1:2 t "bh" with lines, \
     "running_Olden_machcode.txt" u 1:3 t "bisort" with lines, \
     "running_Olden_machcode.txt" u 1:4 t "em3d" with lines, \
     "running_Olden_machcode.txt" u 1:5 t "health" with lines, \
     "running_Olden_machcode.txt" u 1:6 t "mst" with lines, \
     "running_Olden_machcode.txt" u 1:7 t "perimeter" with lines, \
     "running_Olden_machcode.txt" u 1:8 t "power" with lines, \
     "running_Olden_machcode.txt" u 1:9 t "treeadd" with lines, \
     "running_Olden_machcode.txt" u 1:10 t "tsp" with lines, \
     "running_Olden_machcode.txt" u 1:11 t "voronoi" \
   with lines

##------- Bytecode size ----

set size .75,.75
set output "running_Olden_bytecode.png"
set ylabel "Program bytecode size"
plot "running_Olden_bytecode.txt" u 1:2 t '' with lines, \
     "running_Olden_bytecode.txt" u 1:2 t "bh" with lines, \
     "running_Olden_bytecode.txt" u 1:3 t "bisort" with lines, \
     "running_Olden_bytecode.txt" u 1:4 t "em3d" with lines, \
     "running_Olden_bytecode.txt" u 1:5 t "health" with lines, \
     "running_Olden_bytecode.txt" u 1:6 t "mst" with lines, \
     "running_Olden_bytecode.txt" u 1:7 t "perimeter" with lines, \
     "running_Olden_bytecode.txt" u 1:8 t "power" with lines, \
     "running_Olden_bytecode.txt" u 1:9 t "treeadd" with lines, \
     "running_Olden_bytecode.txt" u 1:10 t "tsp" with lines, \
     "running_Olden_bytecode.txt" u 1:11 t "voronoi" \
   with lines

set size 1.5,1.5
set output "running_Olden_bytecode_large.png"
plot "running_Olden_bytecode.txt" u 1:2 t '' with lines, \
     "running_Olden_bytecode.txt" u 1:2 t "bh" with lines, \
     "running_Olden_bytecode.txt" u 1:3 t "bisort" with lines, \
     "running_Olden_bytecode.txt" u 1:4 t "em3d" with lines, \
     "running_Olden_bytecode.txt" u 1:5 t "health" with lines, \
     "running_Olden_bytecode.txt" u 1:6 t "mst" with lines, \
     "running_Olden_bytecode.txt" u 1:7 t "perimeter" with lines, \
     "running_Olden_bytecode.txt" u 1:8 t "power" with lines, \
     "running_Olden_bytecode.txt" u 1:9 t "treeadd" with lines, \
     "running_Olden_bytecode.txt" u 1:10 t "tsp" with lines, \
     "running_Olden_bytecode.txt" u 1:11 t "voronoi" \
   with lines

set terminal png

##------- Plot small Date vs LOC ----
set output "running_loc.png"
set xlabel "Date" "TimesRoman,24"
set ylabel "Lines of Code" "TimesRoman,24"
set xdata time
set timefmt "%Y-%m-%d:"
set format x "%b %d, %Y"

## Various labels for the graph
set label "Reoptimizer\n checkins" at "2003-02-18:", 114000
set label "Modulo Sched\n   checkin" at "2003-03-28:", 119500
set label "Reoptimizer\n checkins" at "2003-06-01:", 134000
set label "'dummy'\nfunction" at "2003-07-20:", 150000
set label "Reoptimizer\n removal" at "2003-08-10:", 132000

set size .75,.75
plot "running_loc.txt" using 1:2 title '', \
     "running_loc.txt" using 1:2 title "Date vs. Lines of Code" with lines

##------- Plot large Date vs LOC ----
set size 1.5,1.5
set output "running_loc_large.png"
plot "running_loc.txt" using 1:2 title '', \
     "running_loc.txt" using 1:2 title "Date vs. Lines of Code" with lines

# Delete all labels...
set nolabel


Add new label

Add new label

git-svn-id: a4a6f32337ebd29ad4763b423022f00f68d1c7b7@8091 91177308-0d34-0410-b5e6-96231b3b80d8

set terminal png

##------- Plot small Date vs LOC ----
set output "running_loc.png"
set xlabel "Date" "TimesRoman,24"
set ylabel "Lines of Code" "TimesRoman,24"
set xdata time
set timefmt "%Y-%m-%d:"
set format x "%b %d, %Y"

## Various labels for the graph
set label "Reoptimizer\n checkins" at "2003-02-18:", 114000
set label "Modulo Sched\n   checkin" at "2003-03-28:", 119500
set label "Reoptimizer\n checkins" at "2003-06-01:", 134000
set label "'dummy'\nfunction" at "2003-07-20:", 150000
set label "Reoptimizer\n removal" at "2003-08-10:", 132000

set size .75,.75
plot "running_loc.txt" using 1:2 title '', \
     "running_loc.txt" using 1:2 title "Date vs. Lines of Code" with lines

##------- Plot large Date vs LOC ----
set size 1.5,1.5
set output "running_loc_large.png"
plot "running_loc.txt" using 1:2 title '', \
     "running_loc.txt" using 1:2 title "Date vs. Lines of Code" with lines

# Delete all labels...
set nolabel

set terminal png

##------- Plot small Date vs LOC ----
set output "running_loc.png"
set xlabel "Date" "TimesRoman,24"
set ylabel "Lines of Code" "TimesRoman,24"
set xdata time
set timefmt "%Y-%m-%d:"
set format x "%b %d, %Y"

## Various labels for the graph
set label "Reoptimizer checkins" at "2003-02-18:", 114000
set label "Modulo Sched checkin" at "2003-03-28:", 119500
set label "Reoptimizer checkins" at "2003-06-01:", 134000
set label "'dummy'\nfunction" at "2003-07-20:", 150000

set size .75,.75
plot "running_loc.txt" using 1:2 title '', \
     "running_loc.txt" using 1:2 title "Date vs. Lines of Code" with lines

##------- Plot large Date vs LOC ----
set size 1.5,1.5
set output "running_loc_large.png"
plot "running_loc.txt" using 1:2 title '', \
     "running_loc.txt" using 1:2 title "Date vs. Lines of Code" with lines

# Delete all labels...
set nolabel


Fix gnuplot script

Fix gnuplot script

# 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 0.5

set border 3 front linewidth 1.000
set boxwidth 0.8 absolute
set style fill   solid 1.00 noborder
set grid nopolar
set grid noxtics nomxtics ytics nomytics noztics nomztics \
 nox2tics nomx2tics noy2tics nomy2tics nocbtics nomcbtics
set grid layerdefault   lt 0 linewidth 0.500,  lt 0 linewidth 0.500
set key bmargin center horizontal Left reverse noenhanced autotitle columnhead nobox maxcols 2 maxrows 1
set style histogram rowstacked title textcolor lt -1 offset character 2, 0.25, 0
set style data histograms
set cbtics border in scale 0,0 mirror norotate  autojustify
set rtics axis in scale 0,0 nomirror norotate  autojustify
set title "Advertisement Impression Counter"
set xlabel "(Client Number)"
set xlabel  offset character 0, -1, 0 font "" textcolor lt -1 norotate
set ylabel "GB Transmitted"
set yrange [0:*]
##set yrange [ 0.00000 : 900000. ] noreverse nowriteback

set linetype 1 lc rgb "#A00000"
set linetype 2 lc rgb "#2c3e50"
set linetype 3 lc rgb "#5060D0"
set linetype 4 lc rgb "#F25900"
set datafile separator ","
set output outputname
plot newhistogram "32", inputname using "32_s":xtic(1) t 'State' lc 3, \
     newhistogram "64", '' u "64_s":xtic(1) t '' lc 3, \
     newhistogram "128", '' u "128_s":xtic(1) t '' lc 3, \
     newhistogram "256", '' u "256_s":xtic(1) t '' lc 3

# 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 0.5

set border 3 front linewidth 1.000
set boxwidth 0.8 absolute
set style fill   solid 1.00 noborder
set grid nopolar
set grid noxtics nomxtics ytics nomytics noztics nomztics \
 nox2tics nomx2tics noy2tics nomy2tics nocbtics nomcbtics
set grid layerdefault   lt 0 linewidth 0.500,  lt 0 linewidth 0.500
set key bmargin center horizontal Left reverse noenhanced autotitle columnhead nobox maxcols 2 maxrows 1
set style histogram rowstacked title textcolor lt -1 offset character 2, 0.25, 0
set style data histograms
set cbtics border in scale 0,0 mirror norotate  autojustify
set rtics axis in scale 0,0 nomirror norotate  autojustify
set title "Advertisement Impression Counter"
set xlabel "(Client Number)"
set xlabel  offset character 0, -1, 0 font "" textcolor lt -1 norotate
set ylabel "GB Transmitted"
set yrange [0:*]
##set yrange [ 0.00000 : 900000. ] noreverse nowriteback

set linetype 1 lc rgb "#A00000"
set linetype 2 lc rgb "#2c3e50"
set linetype 3 lc rgb "#5060D0"
set linetype 4 lc rgb "#F25900"
set datafile separator ","
set output outputname
plot newhistogram "128", inputname using "128_s":xtic(1) t 'State' lc 3, \
     newhistogram "256", '' u "256_s":xtic(1) t '' lc 3, \
     newhistogram "512", '' u "512_s":xtic(1) t '' lc 3, \
     newhistogram "1024", '' u "1024_s":xtic(1) t '' lc 3


two more Makefiles we should consider for a complete rebuild

git-svn-id: 4e7379b20b57f8e3dde5a0b7363f233184647162@512 4e380d45-d1fd-0310-85a7-d18ec86df0ad

# This -*- Makefile -*- is intended for processing with GNU make.

# Change this file according to your paths.

# Instead of modifying this file, you could also set your modified variables
# in make.settings.local (needs to be created first).
-include $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))make.settings.local

USE_BOOST	?= no	# set 'yes' to use Boost libraries or 'no' to not use Boost libraries
USE_LINUX	?= yes	# set 'yes' if you run Linux, 'no' otherwise
USE_MCSTL	?= no	# will be overriden from main Makefile
USE_ICPC	?= no	# will be overriden from main Makefile

STXXL_ROOT	?= $(HOME)/work/stxxl

ifeq ($(strip $(USE_ICPC)),yes)
COMPILER	?= icpc
OPENMPFLAG	?= -openmp
ICPC_MCSTL_CPPFLAGS	?= -gcc-version=420 -cxxlib=$(FAKEGCC)
endif

ifeq ($(strip $(USE_MCSTL)),yes)
COMPILER	?= g++-4.2
OPENMPFLAG	?= -fopenmp
LIBNAME		?= mcstxxl
# the base directory of your MCSTL installation
MCSTL_BASE	?= $(HOME)/work/mcstl
# mcstl branch, leave empty for default branch (e.g. if installed from release tarball)
MCSTL_BRANCH	?= #branches/standalone
# only set the following variables if autodetection does not work:
#MCSTL_ROOT		?= $(MCSTL_BASE)/$(MCSTL_BRANCH)
#MCSTL_ORIGINAL_INC_CXX	?= /path/to/your/$(COMPILER)'s/include/c++
#MCSTL_ORIGINALS	?= /where/you/put/the/original/symlink
endif

#BOOST_ROOT	?= /usr/local/boost-1.34.1

COMPILER	?= g++
LINKER		?= $(COMPILER)
OPT		?= -O3 # compiler optimization level
WARNINGS	?= -Wall
DEBUG		?= # put here -g option to include the debug information into the binaries

LIBNAME		?= stxxl

#### TROUBLESHOOTING
#
# For automatical checking of order of the output elements in
# the sorters: stxxl::stream::sort, stxxl::stream::merge_runs,
# stxxl::sort, and stxxl::ksort use
#
#STXXL_SPECIFIC	+= -DSTXXL_CHECK_ORDER_IN_SORTS
#
# If your program aborts with message "read/write: wrong parameter"
# or "Invalid argument"
# this could be that your kernel does not support direct I/O
# then try to set it off recompiling the libs and your code with option
#
#STXXL_SPECIFIC	+= -DSTXXL_DIRECT_IO_OFF
#
# But for the best performance it is strongly recommended
# to reconfigure the kernel for the support of the direct I/O.
#
# FIXME: documentation needed
#
#STXXL_SPECIFIC += -DSTXXL_DEBUGMON

#### You usually shouldn't need to change the sections below #####

#### STXXL OPTIONS ###############################################

# check, whether stxxl has been configured
ifeq (,$(strip $(wildcard $(STXXL_ROOT)/include/stxxl.h)))
$(warning *** WARNING: STXXL hasn't been configured correctly) #'
$(error ERROR: could not find a STXXL installation in STXXL_ROOT=$(STXXL_ROOT))
endif

# in the top dir, check whether STXXL_ROOT points to ourselves
ifneq (,$(wildcard make.settings))
stat1	 = $(shell stat -L -c '%d:%i' ./)
stat2	 = $(shell stat -L -c '%d:%i' $(STXXL_ROOT)/)

ifneq ($(stat1),$(stat2))
$(error ERROR: STXXL_ROOT=$(STXXL_ROOT) points to a different STXXL installation)
endif
endif

PTHREAD_FLAG	?= -pthread

STXXL_SPECIFIC	+= \
	$(PTHREAD_FLAG) \
	$(CPPFLAGS_ARCH) \
	-DSORT_OPTIMAL_PREFETCHING \
	-DUSE_MALLOC_LOCK \
	-DCOUNT_WAIT_TIME \
	-I$(strip $(STXXL_ROOT))/include \
	-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
	$(POSIX_MEMALIGN) $(XOPEN_SOURCE)

STXXL_LDFLAGS	+= $(PTHREAD_FLAG)
STXXL_LDLIBS	+= -L$(strip $(STXXL_ROOT))/lib -l$(LIBNAME)

STXXL_LIBDEPS	+= $(strip $(STXXL_ROOT))/lib/lib$(LIBNAME).$(LIBEXT)

UNAME_M		:= $(shell uname -m)
CPPFLAGS_ARCH	+= $(CPPFLAGS_$(UNAME_M))
CPPFLAGS_i686	?= -march=i686

##################################################################

#### ICPC OPTIONS ################################################

ifeq ($(strip $(USE_ICPC)),yes)

endif

##################################################################

#### MCSTL OPTIONS ###############################################

ifeq ($(strip $(USE_MCSTL)),yes)

MCSTL_ROOT		?= $(strip $(MCSTL_BASE))$(if $(strip $(MCSTL_BRANCH)),/$(strip $(MCSTL_BRANCH)))

ifeq (,$(strip $(wildcard $(MCSTL_ROOT)/c++/mcstl.h)))
$(error ERROR: could not find a MCSTL installation in MCSTL_ROOT=$(MCSTL_ROOT))
endif

ifeq ($(strip $(USE_ICPC)),yes)
MCSTL_CPPFLAGS		+= $(ICPC_MCSTL_CPPFLAGS)
endif

MCSTL_CPPFLAGS		+= $(OPENMPFLAG) -D__MCSTL__ $(MCSTL_INCLUDES_PREPEND) -I$(MCSTL_ROOT)/c++
MCSTL_LDFLAGS		+= $(OPENMPFLAG)

ifeq (,$(strip $(wildcard $(MCSTL_ROOT)/c++/bits/stl_algo.h)))
# not from libstdc++ branch, need to find the correct original symlink

ifneq (,$(strip $(wildcard $(MCSTL_ROOT)/originals)))
MCSTL_ORIG_BASE		?= $(MCSTL_ROOT)
endif
MCSTL_ORIG_BASE		?= $(MCSTL_BASE)

# find a KEY=VALUE element in WORDS and return VALUE
# usage: $(call get_value,KEY,WORDS)
get_value		 = $(subst $(1)=,,$(filter $(1)=%,$(2)))
empty			 =#
space			 = $(empty) $(empty)
gcc_version_result	:= $(shell $(COMPILER) -v 2>&1)
gcc_version		 = $(call get_value,THE_GCC_VERSION,$(subst gcc$(space)version$(space),THE_GCC_VERSION=,$(gcc_version_result)))
gcc_prefix		 = $(call get_value,--prefix,$(gcc_version_result))
gcc_gxx_incdir		 = $(call get_value,--with-gxx-include-dir,$(gcc_version_result))
MCSTL_ORIGINAL_INC_CXX	?= $(firstword $(wildcard $(gcc_gxx_incdir) $(gcc_prefix)/include/c++/$(gcc_version)) $(cxx_incdir_from_compile))
ifeq (,$(strip $(MCSTL_ORIGINAL_INC_CXX)))
# do a test compilation, generate dependencies and parse the header paths
compile_test_vector_deps:= $(shell echo -e '\043include <vector>' > cxx-header-path-test.cpp; $(COMPILER) -M cxx-header-path-test.cpp 2>/dev/null; $(RM) cxx-header-path-test.cpp)
cxx_incdir_from_compile	 = $(patsubst %/vector,%,$(firstword $(filter %/vector, $(compile_test_vector_deps))))
export cxx_incdir_from_compile
endif
MCSTL_ORIGINALS		?= $(strip $(MCSTL_ORIG_BASE))/originals/$(subst /,_,$(MCSTL_ORIGINAL_INC_CXX))

ifeq (,$(strip $(MCSTL_ORIGINAL_INC_CXX)))
$(error ERROR: could not determine MCSTL_ORIGINAL_INC_CXX, please set this variable manually, it's your compilers ($(COMPILER)) include/c++ path)
endif
ifeq (,$(strip $(wildcard $(MCSTL_ORIGINALS)/original)))
$(error ERROR: your mcstl in $(MCSTL_ORIG_BASE) is not configured properly: $(MCSTL_ORIGINALS)/original does not exist)
endif

MCSTL_CPPFLAGS		+= -I$(MCSTL_ORIGINALS)

else # from libstdc++ branch

MCSTL_INCLUDES_PREPEND	+= $(if $(findstring 4.3,$(COMPILER)),-I$(MCSTL_ROOT)/c++/mod_stl/gcc-4.3)

endif # (not) from libstdc++ branch

endif

##################################################################

#### BOOST OPTIONS ###############################################

BOOST_COMPILER_OPTIONS	 = \
	-DSTXXL_BOOST_TIMESTAMP \
	-DSTXXL_BOOST_CONFIG \
	-DSTXXL_BOOST_FILESYSTEM \
	-DSTXXL_BOOST_THREADS \
	-DSTXXL_BOOST_RANDOM \
	$(if $(strip $(BOOST_ROOT)),-I$(strip $(BOOST_ROOT)))

BOOST_LIB_COMPILER_SUFFIX	?=
BOOST_LIB_MT_SUFFIX		?= -mt
BOOST_LINKER_OPTIONS		 = \
	-lboost_thread$(BOOST_LIB_COMPILER_SUFFIX)$(BOOST_LIB_MT_SUFFIX) \
	-lboost_date_time$(BOOST_LIB_COMPILER_SUFFIX)$(BOOST_LIB_MT_SUFFIX) \
	-lboost_iostreams$(BOOST_LIB_COMPILER_SUFFIX)$(BOOST_LIB_MT_SUFFIX) \
	-lboost_filesystem$(BOOST_LIB_COMPILER_SUFFIX)$(BOOST_LIB_MT_SUFFIX)

##################################################################

#### CPPUNIT OPTIONS ############################################

CPPUNIT_COMPILER_OPTIONS	+=

CPPUNIT_LINKER_OPTIONS		+= -lcppunit -ldl

##################################################################

#### DEPENDENCIES ################################################

HEADER_FILES_BITS	+= namespace.h version.h

HEADER_FILES_COMMON	+= aligned_alloc.h mutex.h rand.h semaphore.h state.h
HEADER_FILES_COMMON	+= timer.h utils.h gprof.h rwlock.h simple_vector.h
HEADER_FILES_COMMON	+= switch.h tmeta.h log.h exceptions.h debug.h tuple.h
HEADER_FILES_COMMON	+= types.h utils_ledasm.h settings.h

HEADER_FILES_IO		+= completion_handler.h io.h iobase.h iostats.h
HEADER_FILES_IO		+= mmap_file.h simdisk_file.h syscall_file.h
HEADER_FILES_IO		+= ufs_file.h wincall_file.h wfs_file.h boostfd_file.h

HEADER_FILES_MNG	+= adaptor.h async_schedule.h block_prefetcher.h
HEADER_FILES_MNG	+= buf_istream.h buf_ostream.h buf_writer.h mng.h
HEADER_FILES_MNG	+= write_pool.h prefetch_pool.h

HEADER_FILES_CONTAINERS	+= pager.h stack.h vector.h priority_queue.h queue.h
HEADER_FILES_CONTAINERS	+= map.h deque.h

HEADER_FILES_CONTAINERS_BTREE	+= btree.h iterator_map.h leaf.h node_cache.h
HEADER_FILES_CONTAINERS_BTREE	+= root_node.h node.h btree_pager.h iterator.h

HEADER_FILES_ALGO	+= adaptor.h inmemsort.h intksort.h run_cursor.h sort.h
HEADER_FILES_ALGO	+= async_schedule.h interleaved_alloc.h ksort.h
HEADER_FILES_ALGO	+= losertree.h scan.h stable_ksort.h random_shuffle.h

HEADER_FILES_STREAM	+= stream.h sort_stream.h

HEADER_FILES_UTILS	+= malloc.h

###################################################################

#### MISC #########################################################

DEPEXT	 = $(LIBNAME).d # extension of dependency files
OBJEXT	 = $(LIBNAME).o	# extension of object files
LIBEXT	 = a		# static library file extension
EXEEXT	 = $(LIBNAME).bin # executable file extension
RM	 = rm -f	# remove file command
LIBGEN	 = ar cr	# library generation
OUT	 = -o		# output file option for the compiler and linker

d	?= $(strip $(DEPEXT))
o	?= $(strip $(OBJEXT))
bin	?= $(strip $(EXEEXT))

###################################################################

#### COMPILE/LINK RULES ###########################################

DEPS_MAKEFILES	:= $(wildcard ../Makefile.subdir.gnu ../make.settings ../make.settings.local GNUmakefile Makefile.local)
%.$o: %.cpp $(DEPS_MAKEFILES)
	@$(RM) $@ $*.$d
	$(COMPILER) $(STXXL_COMPILER_OPTIONS) -MD -MF $*.$dT -c $(OUTPUT_OPTION) $< && mv $*.$dT $*.$d

LINK_STXXL	 = $(LINKER) $1 $(STXXL_LINKER_OPTIONS) -o $@

%.$(bin): %.$o $(STXXL_LIBDEPS)
	$(call LINK_STXXL, $<)

###################################################################

STXXL_COMPILER_OPTIONS	+= $(STXXL_SPECIFIC)
STXXL_COMPILER_OPTIONS	+= $(OPT) $(DEBUG) $(WARNINGS)
STXXL_LINKER_OPTIONS	+= $(STXXL_LDFLAGS)
STXXL_LINKER_OPTIONS	+= $(STXXL_LDLIBS)

ifeq ($(strip $(USE_MCSTL)),yes)
STXXL_COMPILER_OPTIONS	+= $(MCSTL_CPPFLAGS)
STXXL_LINKER_OPTIONS	+= $(MCSTL_LDFLAGS)
endif

ifeq ($(strip $(USE_BOOST)),yes)
STXXL_COMPILER_OPTIONS	+= $(BOOST_COMPILER_OPTIONS)
STXXL_LINKER_OPTIONS	+= $(BOOST_LINKER_OPTIONS)
endif

STXXL_COMPILER_OPTIONS	+= $(CPPFLAGS)

# vim: syn=make

# This -*- Makefile -*- is intended for processing with GNU make.

# Change this file according to your paths.

# Instead of modifying this file, you could also set your modified variables
# in make.settings.local (needs to be created first).
-include $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))make.settings.local

USE_BOOST	?= no	# set 'yes' to use Boost libraries or 'no' to not use Boost libraries
USE_LINUX	?= yes	# set 'yes' if you run Linux, 'no' otherwise
USE_MCSTL	?= no	# will be overriden from main Makefile
USE_ICPC	?= no	# will be overriden from main Makefile

STXXL_ROOT	?= $(HOME)/work/stxxl

ifeq ($(strip $(USE_ICPC)),yes)
COMPILER	?= icpc
OPENMPFLAG	?= -openmp
ICPC_MCSTL_CPPFLAGS	?= -gcc-version=420 -cxxlib=$(FAKEGCC)
endif

ifeq ($(strip $(USE_MCSTL)),yes)
COMPILER	?= g++-4.2
OPENMPFLAG	?= -fopenmp
LIBNAME		?= mcstxxl
# the base directory of your MCSTL installation
MCSTL_BASE	?= $(HOME)/work/mcstl
# mcstl branch, leave empty for default branch (e.g. if installed from release tarball)
MCSTL_BRANCH	?= #branches/standalone
# only set the following variables if autodetection does not work:
#MCSTL_ROOT		?= $(MCSTL_BASE)/$(MCSTL_BRANCH)
#MCSTL_ORIGINAL_INC_CXX	?= /path/to/your/$(COMPILER)'s/include/c++
#MCSTL_ORIGINALS	?= /where/you/put/the/original/symlink
endif

#BOOST_ROOT	?= /usr/local/boost-1.34.1

COMPILER	?= g++
LINKER		?= $(COMPILER)
OPT		?= -O3 # compiler optimization level
WARNINGS	?= -Wall
DEBUG		?= # put here -g option to include the debug information into the binaries

LIBNAME		?= stxxl

#### TROUBLESHOOTING
#
# For automatical checking of order of the output elements in
# the sorters: stxxl::stream::sort, stxxl::stream::merge_runs,
# stxxl::sort, and stxxl::ksort use
#
#STXXL_SPECIFIC	+= -DSTXXL_CHECK_ORDER_IN_SORTS
#
# If your program aborts with message "read/write: wrong parameter"
# or "Invalid argument"
# this could be that your kernel does not support direct I/O
# then try to set it off recompiling the libs and your code with option
#
#STXXL_SPECIFIC	+= -DSTXXL_DIRECT_IO_OFF
#
# But for the best performance it is strongly recommended
# to reconfigure the kernel for the support of the direct I/O.
#
# FIXME: documentation needed
#
#STXXL_SPECIFIC += -DSTXXL_DEBUGMON

#### You usually shouldn't need to change the sections below #####

#### STXXL OPTIONS ###############################################

# check, whether stxxl has been configured
ifeq (,$(strip $(wildcard $(STXXL_ROOT)/include/stxxl.h)))
$(warning *** WARNING: STXXL hasn't been configured correctly) #'
$(error ERROR: could not find a STXXL installation in STXXL_ROOT=$(STXXL_ROOT))
endif

# in the top dir, check whether STXXL_ROOT points to ourselves
ifneq (,$(wildcard make.settings))
stat1	 = $(shell stat -L -c '%d:%i' ./)
stat2	 = $(shell stat -L -c '%d:%i' $(STXXL_ROOT)/)

ifneq ($(stat1),$(stat2))
$(error ERROR: STXXL_ROOT=$(STXXL_ROOT) points to a different STXXL installation)
endif
endif

PTHREAD_FLAG	?= -pthread

STXXL_SPECIFIC	+= \
	$(PTHREAD_FLAG) \
	$(CPPFLAGS_ARCH) \
	-DSORT_OPTIMAL_PREFETCHING \
	-DUSE_MALLOC_LOCK \
	-DCOUNT_WAIT_TIME \
	-I$(strip $(STXXL_ROOT))/include \
	-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
	$(POSIX_MEMALIGN) $(XOPEN_SOURCE)

STXXL_LDFLAGS	+= $(PTHREAD_FLAG)
STXXL_LDLIBS	+= -L$(strip $(STXXL_ROOT))/lib -l$(LIBNAME)

STXXL_LIBDEPS	+= $(strip $(STXXL_ROOT))/lib/lib$(LIBNAME).$(LIBEXT)

UNAME_M		:= $(shell uname -m)
CPPFLAGS_ARCH	+= $(CPPFLAGS_$(UNAME_M))
CPPFLAGS_i686	?= -march=i686

##################################################################

#### ICPC OPTIONS ################################################

ifeq ($(strip $(USE_ICPC)),yes)

endif

##################################################################

#### MCSTL OPTIONS ###############################################

ifeq ($(strip $(USE_MCSTL)),yes)

MCSTL_ROOT		?= $(strip $(MCSTL_BASE))$(if $(strip $(MCSTL_BRANCH)),/$(strip $(MCSTL_BRANCH)))

ifeq (,$(strip $(wildcard $(MCSTL_ROOT)/c++/mcstl.h)))
$(error ERROR: could not find a MCSTL installation in MCSTL_ROOT=$(MCSTL_ROOT))
endif

ifeq ($(strip $(USE_ICPC)),yes)
MCSTL_CPPFLAGS		+= $(ICPC_MCSTL_CPPFLAGS)
endif

MCSTL_CPPFLAGS		+= $(OPENMPFLAG) -D__MCSTL__ $(MCSTL_INCLUDES_PREPEND) -I$(MCSTL_ROOT)/c++
MCSTL_LDFLAGS		+= $(OPENMPFLAG)

ifeq (,$(strip $(wildcard $(MCSTL_ROOT)/c++/bits/stl_algo.h)))
# not from libstdc++ branch, need to find the correct original symlink

ifneq (,$(strip $(wildcard $(MCSTL_ROOT)/originals)))
MCSTL_ORIG_BASE		?= $(MCSTL_ROOT)
endif
MCSTL_ORIG_BASE		?= $(MCSTL_BASE)

# find a KEY=VALUE element in WORDS and return VALUE
# usage: $(call get_value,KEY,WORDS)
get_value		 = $(subst $(1)=,,$(filter $(1)=%,$(2)))
empty			 =#
space			 = $(empty) $(empty)
gcc_version_result	:= $(shell $(COMPILER) -v 2>&1)
gcc_version		 = $(call get_value,THE_GCC_VERSION,$(subst gcc$(space)version$(space),THE_GCC_VERSION=,$(gcc_version_result)))
gcc_prefix		 = $(call get_value,--prefix,$(gcc_version_result))
gcc_gxx_incdir		 = $(call get_value,--with-gxx-include-dir,$(gcc_version_result))
MCSTL_ORIGINAL_INC_CXX	?= $(firstword $(wildcard $(gcc_gxx_incdir) $(gcc_prefix)/include/c++/$(gcc_version)) $(cxx_incdir_from_compile))
ifeq (,$(strip $(MCSTL_ORIGINAL_INC_CXX)))
# do a test compilation, generate dependencies and parse the header paths
compile_test_vector_deps:= $(shell echo -e '\043include <vector>' > cxx-header-path-test.cpp; $(COMPILER) -M cxx-header-path-test.cpp 2>/dev/null; $(RM) cxx-header-path-test.cpp)
cxx_incdir_from_compile	 = $(patsubst %/vector,%,$(firstword $(filter %/vector, $(compile_test_vector_deps))))
export cxx_incdir_from_compile
endif
MCSTL_ORIGINALS		?= $(strip $(MCSTL_ORIG_BASE))/originals/$(subst /,_,$(MCSTL_ORIGINAL_INC_CXX))

ifeq (,$(strip $(MCSTL_ORIGINAL_INC_CXX)))
$(error ERROR: could not determine MCSTL_ORIGINAL_INC_CXX, please set this variable manually, it's your compilers ($(COMPILER)) include/c++ path)
endif
ifeq (,$(strip $(wildcard $(MCSTL_ORIGINALS)/original)))
$(error ERROR: your mcstl in $(MCSTL_ORIG_BASE) is not configured properly: $(MCSTL_ORIGINALS)/original does not exist)
endif

MCSTL_CPPFLAGS		+= -I$(MCSTL_ORIGINALS)

else # from libstdc++ branch

MCSTL_INCLUDES_PREPEND	+= $(if $(findstring 4.3,$(COMPILER)),-I$(MCSTL_ROOT)/c++/mod_stl/gcc-4.3)

endif # (not) from libstdc++ branch

endif

##################################################################

#### BOOST OPTIONS ###############################################

BOOST_COMPILER_OPTIONS	 = \
	-DSTXXL_BOOST_TIMESTAMP \
	-DSTXXL_BOOST_CONFIG \
	-DSTXXL_BOOST_FILESYSTEM \
	-DSTXXL_BOOST_THREADS \
	-DSTXXL_BOOST_RANDOM \
	$(if $(strip $(BOOST_ROOT)),-I$(strip $(BOOST_ROOT)))

BOOST_LIB_COMPILER_SUFFIX	?=
BOOST_LIB_MT_SUFFIX		?= -mt
BOOST_LINKER_OPTIONS		 = \
	-lboost_thread$(BOOST_LIB_COMPILER_SUFFIX)$(BOOST_LIB_MT_SUFFIX) \
	-lboost_date_time$(BOOST_LIB_COMPILER_SUFFIX)$(BOOST_LIB_MT_SUFFIX) \
	-lboost_iostreams$(BOOST_LIB_COMPILER_SUFFIX)$(BOOST_LIB_MT_SUFFIX) \
	-lboost_filesystem$(BOOST_LIB_COMPILER_SUFFIX)$(BOOST_LIB_MT_SUFFIX)

##################################################################

#### CPPUNIT OPTIONS ############################################

CPPUNIT_COMPILER_OPTIONS	+=

CPPUNIT_LINKER_OPTIONS		+= -lcppunit -ldl

##################################################################

#### DEPENDENCIES ################################################

HEADER_FILES_BITS	+= namespace.h version.h

HEADER_FILES_COMMON	+= aligned_alloc.h mutex.h rand.h semaphore.h state.h
HEADER_FILES_COMMON	+= timer.h utils.h gprof.h rwlock.h simple_vector.h
HEADER_FILES_COMMON	+= switch.h tmeta.h log.h exceptions.h debug.h tuple.h
HEADER_FILES_COMMON	+= types.h utils_ledasm.h settings.h

HEADER_FILES_IO		+= completion_handler.h io.h iobase.h iostats.h
HEADER_FILES_IO		+= mmap_file.h simdisk_file.h syscall_file.h
HEADER_FILES_IO		+= ufs_file.h wincall_file.h wfs_file.h boostfd_file.h

HEADER_FILES_MNG	+= adaptor.h async_schedule.h block_prefetcher.h
HEADER_FILES_MNG	+= buf_istream.h buf_ostream.h buf_writer.h mng.h
HEADER_FILES_MNG	+= write_pool.h prefetch_pool.h

HEADER_FILES_CONTAINERS	+= pager.h stack.h vector.h priority_queue.h queue.h
HEADER_FILES_CONTAINERS	+= map.h deque.h

HEADER_FILES_CONTAINERS_BTREE	+= btree.h iterator_map.h leaf.h node_cache.h
HEADER_FILES_CONTAINERS_BTREE	+= root_node.h node.h btree_pager.h iterator.h

HEADER_FILES_ALGO	+= adaptor.h inmemsort.h intksort.h run_cursor.h sort.h
HEADER_FILES_ALGO	+= async_schedule.h interleaved_alloc.h ksort.h
HEADER_FILES_ALGO	+= losertree.h scan.h stable_ksort.h random_shuffle.h

HEADER_FILES_STREAM	+= stream.h sort_stream.h

HEADER_FILES_UTILS	+= malloc.h

###################################################################

#### MISC #########################################################

DEPEXT	 = $(LIBNAME).d # extension of dependency files
OBJEXT	 = $(LIBNAME).o	# extension of object files
LIBEXT	 = a		# static library file extension
EXEEXT	 = $(LIBNAME).bin # executable file extension
RM	 = rm -f	# remove file command
LIBGEN	 = ar cr	# library generation
OUT	 = -o		# output file option for the compiler and linker

d	?= $(strip $(DEPEXT))
o	?= $(strip $(OBJEXT))
bin	?= $(strip $(EXEEXT))

###################################################################

#### COMPILE/LINK RULES ###########################################

DEPS_MAKEFILES	:= $(wildcard ../Makefile.subdir.gnu ../make.settings ../make.settings.local)
%.$o: %.cpp $(DEPS_MAKEFILES)
	@$(RM) $@ $*.$d
	$(COMPILER) $(STXXL_COMPILER_OPTIONS) -MD -MF $*.$dT -c $(OUTPUT_OPTION) $< && mv $*.$dT $*.$d

LINK_STXXL	 = $(LINKER) $1 $(STXXL_LINKER_OPTIONS) -o $@

%.$(bin): %.$o $(STXXL_LIBDEPS)
	$(call LINK_STXXL, $<)

###################################################################

STXXL_COMPILER_OPTIONS	+= $(STXXL_SPECIFIC)
STXXL_COMPILER_OPTIONS	+= $(OPT) $(DEBUG) $(WARNINGS)
STXXL_LINKER_OPTIONS	+= $(STXXL_LDFLAGS)
STXXL_LINKER_OPTIONS	+= $(STXXL_LDLIBS)

ifeq ($(strip $(USE_MCSTL)),yes)
STXXL_COMPILER_OPTIONS	+= $(MCSTL_CPPFLAGS)
STXXL_LINKER_OPTIONS	+= $(MCSTL_LDFLAGS)
endif

ifeq ($(strip $(USE_BOOST)),yes)
STXXL_COMPILER_OPTIONS	+= $(BOOST_COMPILER_OPTIONS)
STXXL_LINKER_OPTIONS	+= $(BOOST_LINKER_OPTIONS)
endif

STXXL_COMPILER_OPTIONS	+= $(CPPFLAGS)

# vim: syn=make


update gnuplot script

update gnuplot script

#!/Applications/Gnuplot.app/Contents/Resources/bin/gnuplot
#
#
#    	G N U P L O T
#    	Version 5.0 patchlevel 5    last modified 2016-10-02
#
#    	Copyright (C) 1986-1993, 1998, 2004, 2007-2016
#    	Thomas Williams, Colin Kelley and many others
#
#    	gnuplot home:     http://www.gnuplot.info
#    	faq, bugs, etc:   type "help FAQ"
#    	immediate help:   type "help"  (plot window: hit 'h')
# set terminal wxt 0 enhanced
# set output
set term pdfcairo enhanced font 'Times,26' lw 3 size 8,6
set output 'T-BFO222-disp.pdf'
set datafile separator ","
set encoding iso_8859_1
#set encoding default
unset clip points
set clip one
unset clip two
set bar 1.000000 front
set border 31 front lt black linewidth 1.000 dashtype solid
set zdata
set ydata
set xdata
set y2data
set x2data
set boxwidth
set style fill  empty border
set style rectangle back fc  bgnd fillstyle   solid 1.00 border lt -1
set style circle radius graph 0.02, first 0.00000, 0.00000
set style ellipse size graph 0.05, 0.03, first 0.00000 angle 0 units xy
set dummy x, y
set format x "% h"
set format y "% h"
set format x2 "% h"
set format y2 "% h"
set format z "% h"
set format cb "% h"
set format r "% h"
set timefmt "%d/%m/%y,%H:%M"
set angles radians
set tics back
unset grid
set raxis
set style parallel front  lt black linewidth 2.000 dashtype solid
set key title "" center
set key inside right top vertical Right noreverse enhanced autotitle nobox
set key noinvert samplen 4 spacing 1 width 0 height 0
set key maxcolumns 0 maxrows 0
set key noopaque
unset label
unset arrow
set style increment default
unset style line
unset style arrow
set style histogram clustered gap 2 title textcolor lt -1
unset object
set style textbox transparent margins  1.0,  1.0 border
unset logscale
set offsets 0, 0, 0, 0
set pointsize 1
set pointintervalbox 1
unset polar
unset parametric
unset decimalsign
unset minussign
set view 60, 30, 1, 1
set samples 100, 100
set isosamples 10, 10
set surface
unset contour
set cntrlabel  format '%8.3g' font '' start 5 interval 20
set mapping cartesian
unset hidden3d
set cntrparam order 4
set cntrparam linear
set cntrparam levels auto 5
set cntrparam points 5
set size ratio 0 1,1
set origin 0,0
set style data points
set style function lines
unset xzeroaxis
unset yzeroaxis
unset zzeroaxis
unset x2zeroaxis
unset y2zeroaxis
set xyplane relative 0.5
set tics scale  1, 0.5, 1, 1, 1
set mxtics default
set mytics default
set mztics default
set mx2tics default
set my2tics default
set mcbtics default
set mrtics default
set xtics border in scale 1,0.5 mirror norotate  autojustify
set xtics  norangelimit autofreq
set ytics border in scale 1,0.5 mirror norotate  autojustify
set ytics  norangelimit autofreq
set ztics border in scale 1,0.5 nomirror norotate  autojustify
set ztics  norangelimit autofreq
unset x2tics
unset y2tics
set cbtics border in scale 1,0.5 mirror norotate  autojustify
set cbtics  norangelimit autofreq
set rtics axis in scale 1,0.5 nomirror norotate  autojustify
set rtics  norangelimit autofreq
unset paxis 1 tics
unset paxis 2 tics
unset paxis 3 tics
unset paxis 4 tics
unset paxis 5 tics
unset paxis 6 tics
unset paxis 7 tics
set title ""
set title  font "" norotate
set timestamp bottom
set timestamp ""
set timestamp  font "" norotate
set rrange [ * : * ] noreverse nowriteback
set trange [ * : * ] noreverse nowriteback
set urange [ * : * ] noreverse nowriteback
set vrange [ * : * ] noreverse nowriteback
#set xlabel "Pressure (GPa)"
set xlabel "{/Helvetica-Italic P} (GPa)"
set xlabel  font "" textcolor lt -1 norotate
set x2label ""
set x2label  font "" textcolor lt -1 norotate
set xrange [ * : * ] noreverse nowriteback
set x2range [ * : * ] noreverse nowriteback
set ylabel "Fe-O displacement (\305)"
set ylabel  font "" textcolor lt -1 rotate by -270
set y2label ""
set y2label  font "" textcolor lt -1 rotate by -270
set yrange [ * : * ] noreverse nowriteback
set y2range [ * : * ] noreverse nowriteback
set zlabel ""
set zlabel  font "" textcolor lt -1 norotate
set zrange [ * : * ] noreverse nowriteback
set cblabel ""
set cblabel  font "" textcolor lt -1 rotate by -270
set cbrange [ * : * ] noreverse nowriteback
set paxis 1 range [ * : * ] noreverse nowriteback
set paxis 2 range [ * : * ] noreverse nowriteback
set paxis 3 range [ * : * ] noreverse nowriteback
set paxis 4 range [ * : * ] noreverse nowriteback
set paxis 5 range [ * : * ] noreverse nowriteback
set paxis 6 range [ * : * ] noreverse nowriteback
set paxis 7 range [ * : * ] noreverse nowriteback
set zero 1e-08
set lmargin  -1
set bmargin  -1
set rmargin  -1
set tmargin  -1
set locale "C"
set pm3d explicit at s
set pm3d scansautomatic
set pm3d interpolate 1,1 flush begin noftriangles noborder corners2color mean
set palette positive nops_allcF maxcolors 0 gamma 1.5 color model RGB
set palette rgbformulae 7, 5, 15
set colorbox default
set colorbox vertical origin screen 0.9, 0.2, 0 size screen 0.05, 0.6, 0 front  noinvert bdefault
set style boxplot candles range  1.50 outliers pt 7 separation 1 labels auto unsorted
set loadpath
set fontpath
set psdir
set fit brief errorvariables nocovariancevariables errorscaling prescale nowrap v5
#GNUTERM = "wxt"
x = 0.0
## Last datafile plotted: "T-BFO222-1Ca-v1.csv"
plot 'T-BFO222-pure-v1.csv'  u ($1/10):2 w lp lw 2 ps 2 lt 7 lc 1 t '40-atom T-BiFeO3', 'T-BFO-sqrt2-sqrt2-2-1Ca.csv' u ($1/10):2 w lp lw 2 ps 2 lt 7 lc 2 t 'BFO-20atoms-1Ca', 'T-BFO222-1Ca-v1.csv' u ($1/10):2 w lp lw 2 ps 2 lt 7 lc 3 t 'BFO-40atoms-1Ca'
#    EOF

#!/Applications/Gnuplot.app/Contents/Resources/bin/gnuplot
#
#
#    	G N U P L O T
#    	Version 5.0 patchlevel 5    last modified 2016-10-02
#
#    	Copyright (C) 1986-1993, 1998, 2004, 2007-2016
#    	Thomas Williams, Colin Kelley and many others
#
#    	gnuplot home:     http://www.gnuplot.info
#    	faq, bugs, etc:   type "help FAQ"
#    	immediate help:   type "help"  (plot window: hit 'h')
# set terminal wxt 0 enhanced
# set output
set term pdfcairo enhanced font 'Times,26' lw 3 size 8,6
set output 'T-BFO222-disp.pdf'
set datafile separator ","
set encoding iso_8859_1
#set encoding default
unset clip points
set clip one
unset clip two
set bar 1.000000 front
set border 31 front lt black linewidth 1.000 dashtype solid
set zdata
set ydata
set xdata
set y2data
set x2data
set boxwidth
set style fill  empty border
set style rectangle back fc  bgnd fillstyle   solid 1.00 border lt -1
set style circle radius graph 0.02, first 0.00000, 0.00000
set style ellipse size graph 0.05, 0.03, first 0.00000 angle 0 units xy
set dummy x, y
set format x "% h"
set format y "% h"
set format x2 "% h"
set format y2 "% h"
set format z "% h"
set format cb "% h"
set format r "% h"
set timefmt "%d/%m/%y,%H:%M"
set angles radians
set tics back
unset grid
set raxis
set style parallel front  lt black linewidth 2.000 dashtype solid
set key title "" center
set key inside right top vertical Right noreverse enhanced autotitle nobox
set key noinvert samplen 4 spacing 1 width 0 height 0
set key maxcolumns 0 maxrows 0
set key noopaque
unset label
unset arrow
set style increment default
unset style line
unset style arrow
set style histogram clustered gap 2 title textcolor lt -1
unset object
set style textbox transparent margins  1.0,  1.0 border
unset logscale
set offsets 0, 0, 0, 0
set pointsize 1
set pointintervalbox 1
unset polar
unset parametric
unset decimalsign
unset minussign
set view 60, 30, 1, 1
set samples 100, 100
set isosamples 10, 10
set surface
unset contour
set cntrlabel  format '%8.3g' font '' start 5 interval 20
set mapping cartesian
unset hidden3d
set cntrparam order 4
set cntrparam linear
set cntrparam levels auto 5
set cntrparam points 5
set size ratio 0 1,1
set origin 0,0
set style data points
set style function lines
unset xzeroaxis
unset yzeroaxis
unset zzeroaxis
unset x2zeroaxis
unset y2zeroaxis
set xyplane relative 0.5
set tics scale  1, 0.5, 1, 1, 1
set mxtics default
set mytics default
set mztics default
set mx2tics default
set my2tics default
set mcbtics default
set mrtics default
set xtics border in scale 1,0.5 mirror norotate  autojustify
set xtics  norangelimit autofreq
set ytics border in scale 1,0.5 mirror norotate  autojustify
set ytics  norangelimit autofreq
set ztics border in scale 1,0.5 nomirror norotate  autojustify
set ztics  norangelimit autofreq
unset x2tics
unset y2tics
set cbtics border in scale 1,0.5 mirror norotate  autojustify
set cbtics  norangelimit autofreq
set rtics axis in scale 1,0.5 nomirror norotate  autojustify
set rtics  norangelimit autofreq
unset paxis 1 tics
unset paxis 2 tics
unset paxis 3 tics
unset paxis 4 tics
unset paxis 5 tics
unset paxis 6 tics
unset paxis 7 tics
set title ""
set title  font "" norotate
set timestamp bottom
set timestamp ""
set timestamp  font "" norotate
set rrange [ * : * ] noreverse nowriteback
set trange [ * : * ] noreverse nowriteback
set urange [ * : * ] noreverse nowriteback
set vrange [ * : * ] noreverse nowriteback
#set xlabel "Pressure (GPa)"
set xlabel "{/Helvetica-Italic P} (GPa)"
set xlabel  font "" textcolor lt -1 norotate
set x2label ""
set x2label  font "" textcolor lt -1 norotate
set xrange [ * : * ] noreverse nowriteback
set x2range [ * : * ] noreverse nowriteback
set ylabel "Fe-O displacement (\305)"
set ylabel  font "" textcolor lt -1 rotate by -270
set y2label ""
set y2label  font "" textcolor lt -1 rotate by -270
set yrange [ * : * ] noreverse nowriteback
set y2range [ * : * ] noreverse nowriteback
set zlabel ""
set zlabel  font "" textcolor lt -1 norotate
set zrange [ * : * ] noreverse nowriteback
set cblabel ""
set cblabel  font "" textcolor lt -1 rotate by -270
set cbrange [ * : * ] noreverse nowriteback
set paxis 1 range [ * : * ] noreverse nowriteback
set paxis 2 range [ * : * ] noreverse nowriteback
set paxis 3 range [ * : * ] noreverse nowriteback
set paxis 4 range [ * : * ] noreverse nowriteback
set paxis 5 range [ * : * ] noreverse nowriteback
set paxis 6 range [ * : * ] noreverse nowriteback
set paxis 7 range [ * : * ] noreverse nowriteback
set zero 1e-08
set lmargin  -1
set bmargin  -1
set rmargin  -1
set tmargin  -1
set locale "C"
set pm3d explicit at s
set pm3d scansautomatic
set pm3d interpolate 1,1 flush begin noftriangles noborder corners2color mean
set palette positive nops_allcF maxcolors 0 gamma 1.5 color model RGB
set palette rgbformulae 7, 5, 15
set colorbox default
set colorbox vertical origin screen 0.9, 0.2, 0 size screen 0.05, 0.6, 0 front  noinvert bdefault
set style boxplot candles range  1.50 outliers pt 7 separation 1 labels auto unsorted
set loadpath
set fontpath
set psdir
set fit brief errorvariables nocovariancevariables errorscaling prescale nowrap v5
#GNUTERM = "wxt"
x = 0.0
## Last datafile plotted: "T-BFO222-1Ca-v1.csv"
plot 'T-BFO222-pure-v1.csv'  u ($1/10):2 w lp lw 2 ps 2 lt 7 lc 2 t '40-atom T-BiFeO3', 'T-BFO222-1Ca-v1.csv' u ($1/10):2 w lp lw 2 ps 2 lt 7 lc 1 t 'BFO222-1Ca'
#    EOF


trying to stack bars

trying to stack bars


update

update

# Tested with gnuplot 4.6 patchlevel 6

FN_IN = system("echo $FN_IN")
FN_OUT = system("echo $FN_OUT")

# Get min and max values
set terminal unknown
plot \
FN_IN every 31 u 0:1 w points not

set terminal pdfcairo enhanced size 3in, 2in
set output FN_OUT

#set tmargin at screen 0.975
#set bmargin at screen 0.152
#set lmargin at screen 0.185
#set rmargin at screen 0.940

set xlabel "Operation order (normalized)" offset 0,0.3
set ylabel "Key (sequantially reassigned)" offset 1.6,0

set border (1 + 2) lc rgb "#808080"
set ytics nomirror scale 0.5,0 tc rgb "#808080"
set xtics nomirror scale 0.5,0 tc rgb "#808080"

#set xdata time
#set timefmt "%H:%M:%S"
#set format x "%.1S"

set pointsize 0.02

plot \
FN_IN every 31 u ($0/GPVAL_DATA_X_MAX):($1/GPVAL_DATA_Y_MAX) w points pt 7 not

# Tested with gnuplot 4.6 patchlevel 6

FN_IN = system("echo $FN_IN")
FN_OUT = system("echo $FN_OUT")

# Get min and max values
set terminal unknown
plot \
FN_IN every 31 u 0:1 w points not

set terminal pdfcairo enhanced size 3in, 2in
set output FN_OUT

#set tmargin at screen 0.975
#set bmargin at screen 0.152
#set lmargin at screen 0.185
#set rmargin at screen 0.940

set xlabel "Operation order (normalized)" offset 0,0.3
set ylabel "Key (normalized)" offset 1.6,0

set border (1 + 2) lc rgb "#808080"
set ytics nomirror scale 0.5,0 tc rgb "#808080"
set xtics nomirror scale 0.5,0 tc rgb "#808080"

#set xdata time
#set timefmt "%H:%M:%S"
#set format x "%.1S"

set pointsize 0.02

plot \
FN_IN every 31 u ($0/GPVAL_DATA_X_MAX):($1/GPVAL_DATA_Y_MAX) w points pt 7 not


Improved scaling some of the plots.

Improved scaling some of the plots.

MPARM = 1
NPARM = 2
KPARM = 3
FLOPS = 8
MEMBW = 9

HIM = -1
HIN = HIM
HIK = HIM
MN = 23
PEAK = 0 #985.6

BASENAME = "cp2k"
FILENAME = system("sh -c \"echo ${FILENAME}\"")
if (FILENAME eq "") {
  FILENAME = BASENAME."-perf.pdf"
}

FILECOUNT = 1 # initial file number
# MULTI =-1: multiple files; no titles
# MULTI = 0: multiple files with titles
# MULTI = 1: single file with titles
MULTI = system("sh -c \"echo ${MULTI}\"")
if (MULTI eq "") {
  MULTI = 1
}

XFLOPS(M, N, K) = 2.0 * M * N * K
NFLOPS(M, N, K) = XFLOPS(column(M), column(N), column(K))
NBYTES(M, N, K, ELEMSIZE) = ELEMSIZE * (column(M) * column(K) + column(K) * column(N) + column(M) * column(N))
AI(M, N, K, ELEMSIZE) = NFLOPS(M, N, K) / NBYTES(M, N, K, ELEMSIZE)

stats BASENAME."-perf.dat" using (column(MPARM)*column(NPARM)*column(KPARM)) nooutput; MNK = STATS_stddev**(1.0/3.0); MAXMNK = int(STATS_max)
stats BASENAME."-perf.dat" using (log(column(FLOPS))) nooutput; GEO = exp(STATS_sum/STATS_records)
stats BASENAME."-perf.dat" using FLOPS nooutput; MED = STATS_median; MINFLOPS = STATS_min; MAXFLOPS = STATS_max
stats BASENAME."-perf.dat" using NPARM nooutput; XN = int(STATS_max)

MAX(A, B) = A < B ? B : A
ACC = sprintf("%%.%if", ceil(MAX(1.0 / log10(MED) - 1.0, 0)))

IX(I1, J1, NJ) = int(MAX(I1 - 1, 0) * NJ + MAX(J1 - 1, 0))
I1(IX, NJ) = int(IX / NJ) + 1
J1(IX, NJ) = int(IX) % NJ + 1

set table BASENAME."-perf-avg.dat"
plot BASENAME."-perf.dat" using (IX(column(MPARM), column(NPARM), XN)):FLOPS smooth unique
unset table
set table BASENAME."-perf-mbw.dat"
plot BASENAME."-perf.dat" using MEMBW:(1.0) smooth cumulative
unset table
set table BASENAME."-perf-cdf.dat"
plot BASENAME."-perf.dat" using FLOPS:(1.0) smooth cumulative
unset table
stats BASENAME."-perf-cdf.dat" using (("".strcol(3)."" eq "i")?($2):(1/0)) nooutput; FREQSUM = STATS_max; FREQN = STATS_records

if (MULTI==1) {
  set output FILENAME
}

FILEEXT = system("sh -c \"echo ".FILENAME." | sed 's/.\\+\\.\\(.\\+\\)/\\1/'\"")
set terminal FILEEXT
set termoption enhanced
#set termoption font ",12"
save_encoding = GPVAL_ENCODING
set encoding utf8

reset
if (MULTI<=0) { set output "".FILECOUNT."-".FILENAME; FILECOUNT = FILECOUNT + 1 }
if (MULTI>-1) { set title "Performance" }
set origin -0.03, 0
set pm3d interpolate 0, 0
#set colorbox horizontal user origin 0, 0.1 size 1, 0.1
#set autoscale fix
if (0<HIM) { set xrange [*:HIM] }
if (0<HIN) { set yrange [*:HIN] }
if (0<HIK) { set zrange [*:HIK] }
if (0>HIM) { set xrange [*:MNK] }
if (0>HIN) { set yrange [*:MNK] }
if (0>HIK) { set zrange [*:MNK] }
set xlabel "M"
set ylabel "N" offset -3.0
set zlabel "K" offset 1.0
set ticslevel 0
set cblabel "GFLOP/s" offset 1.5
set format x "%g"; set format y "%g"; set format z "%g"; set format cb "%g"
splot BASENAME."-perf.dat" using MPARM:NPARM:KPARM:FLOPS notitle with points pointtype 7 linetype palette

reset
if (MULTI<=0) { set output "".FILECOUNT."-".FILENAME; FILECOUNT = FILECOUNT + 1 }
if (MULTI>-1) { set title "Performance (K-Average)" }
set origin -0.02, 0
set dgrid3d #9, 9
set pm3d interpolate 0, 0 map
set autoscale fix
set xlabel "M"
set ylabel "N" offset -1.5
set cblabel "GFLOP/s" offset 0.5
set format x "%g"; set format y "%g"; set format cb "%g"
set mxtics 2
splot BASENAME."-perf-avg.dat" using (("".strcol(3)."" eq "i")?(I1($1, XN)):(1/0)):(("".strcol(3)."" eq "i")?(J1($1, XN)):(1/0)):2 notitle with pm3d

reset
if (MULTI<=0) { set output "".FILECOUNT."-".FILENAME; FILECOUNT = FILECOUNT + 1 }
if (MULTI>-1) { set title "Performance (Average per Bin)" }
set style fill solid 0.4 noborder
set boxwidth 0.5
set grid y2tics linecolor "grey"
unset key
unset xtics
set xtics ("MNK <= 13^3" 0, "13^3 < MNK <= 23^3" 1, "23^3 < MNK" 2) scale 0 offset 0, 0.2
set x2tics ("Small" 0, "Medium" 1, "Larger" 2) scale 0
set xlabel "Problem Size (MNK)"
set ytics format ""
set y2tics nomirror
set y2label "GFLOP/s"
set xrange [-0.5:2.5]
set autoscale fix
plot  BASENAME."-perf.dat" \
      using (0.0):((NFLOPS(MPARM,NPARM,KPARM)<=XFLOPS(13,13,13))?column(FLOPS):1/0) notitle smooth unique with boxes linetype 1 linecolor "grey", \
  ""  using (1.0):(((XFLOPS(13,13,13)<NFLOPS(MPARM,NPARM,KPARM))&&(NFLOPS(MPARM,NPARM,KPARM)<=XFLOPS(23,23,23)))?column(FLOPS):1/0) notitle smooth unique with boxes linetype 1 linecolor "grey", \
  ""  using (2.0):((XFLOPS(23,23,23)<NFLOPS(MPARM,NPARM,KPARM))?column(FLOPS):1/0) notitle smooth unique with boxes linetype 1 linecolor "grey"

reset
if (MULTI<=0) { set output "".FILECOUNT."-".FILENAME; FILECOUNT = FILECOUNT + 1 }
if (MULTI>-1) { set title "Performance and Memory Bandwidth (CDF)" }
set xlabel "Probability\n\n{/=8 Minimum: ".sprintf(ACC, MINFLOPS)." GFLOP/s  Geo. Mean: ".sprintf(ACC, GEO)." GFLOP/s  Median: ".sprintf(ACC, MED)." GFLOP/s  Maximum: ".sprintf(ACC, MAXFLOPS)." GFLOP/s}"
set ylabel "GB/s"
set y2label "GFLOP/s"
set format x "%g%%"
set format y "%g"
set format y2 "%g"
set ytics nomirror
set y2tics nomirror
set grid x y2 linecolor "grey"
set xrange [0:100]
set yrange [0:*]
set y2range [0:*]
set fit quiet
f(x) = b * x + a
fit f(x) BASENAME."-perf-cdf.dat" using (("".strcol(3)."" eq "i")?(100*$2/FREQSUM):(1/0)):1 via a, b
g(x) = (x - a) / b
x50 = 0.5 * (100 + MAX(0, g(0)))
h(x) = d * x + c
dx = 100 / FREQN
fit [x50-1.5*dx:x50+1.5*dx] h(x) BASENAME."-perf-cdf.dat" using (("".strcol(3)."" eq "i")?(100*$2/FREQSUM):(1/0)):1 via c, d
set arrow from x50, second h(x50) to x50, second 0 front
set arrow from x50, second h(x50) to 100, second h(x50) front
set label sprintf("%.0f%%", x50) at x50, second 0.5 * h(x50) left offset 1 front
set label sprintf(ACC." GFLOP/s", h(x50)) at 0.5 * (x50 + 100.0), second h(x50) centre offset 0, -1 front
set key left invert
plot  BASENAME."-perf-mbw.dat" using (("".strcol(3)."" eq "i")?(100*$2/FREQSUM):(1/0)):1 axes x1y1 title "Memory Bandwidth" with lines linecolor "grey", \
      BASENAME."-perf-cdf.dat" using (("".strcol(3)."" eq "i")?(100*$2/FREQSUM):(1/0)):1 axes x1y2 title "Compute Performance" with lines linewidth 2

reset
if (MULTI<=0) { set output "".FILECOUNT."-".FILENAME; FILECOUNT = FILECOUNT + 1 }
if (MULTI>-1) { set title "Performance and Arithmetic Intensity" }
set grid x y2 linecolor "grey"
set key left #spacing 0.5
set ytics format ""
set y2tics nomirror
set y2label "GFLOP/s"
set xlabel "FLOPS/Byte"
set autoscale fix
plot  BASENAME."-perf.dat" using (AI(MPARM,NPARM,KPARM,8)):FLOPS notitle smooth sbezier with lines linecolor "grey", \
                        "" using (AI(MPARM,NPARM,KPARM,8)):FLOPS notitle smooth unique with points pointtype 7 pointsize 0.1

MPARM = 1
NPARM = 2
KPARM = 3
FLOPS = 8
MEMBW = 9

HIM = -1
HIN = HIM
HIK = HIM
MN = 23
PEAK = 0 #985.6

BASENAME = "cp2k"
FILENAME = system("sh -c \"echo ${FILENAME}\"")
if (FILENAME eq "") {
  FILENAME = BASENAME."-perf.pdf"
}

FILECOUNT = 1 # initial file number
# MULTI =-1: multiple files; no titles
# MULTI = 0: multiple files with titles
# MULTI = 1: single file with titles
MULTI = system("sh -c \"echo ${MULTI}\"")
if (MULTI eq "") {
  MULTI = 1
}

XFLOPS(M, N, K) = 2.0 * M * N * K
NFLOPS(M, N, K) = XFLOPS(column(M), column(N), column(K))
NBYTES(M, N, K, ELEMSIZE) = ELEMSIZE * (column(M) * column(K) + column(K) * column(N) + column(M) * column(N))
AI(M, N, K, ELEMSIZE) = NFLOPS(M, N, K) / NBYTES(M, N, K, ELEMSIZE)

stats BASENAME."-perf.dat" using (column(MPARM)*column(NPARM)*column(KPARM)) nooutput; MNK = STATS_stddev**(1.0/3.0); MAXMNK = int(STATS_max)
stats BASENAME."-perf.dat" using (log(column(FLOPS))) nooutput; GEO = exp(STATS_sum/STATS_records)
stats BASENAME."-perf.dat" using FLOPS nooutput; MED = STATS_median; MINFLOPS = STATS_min; MAXFLOPS = STATS_max
stats BASENAME."-perf.dat" using NPARM nooutput; XN = int(STATS_max)

MAX(A, B) = A < B ? B : A
ACC = sprintf("%%.%if", ceil(MAX(1.0 / log10(MED) - 1.0, 0)))

IX(I1, J1, NJ) = int(MAX(I1 - 1, 0) * NJ + MAX(J1 - 1, 0))
I1(IX, NJ) = int(IX / NJ) + 1
J1(IX, NJ) = int(IX) % NJ + 1

set table BASENAME."-perf-avg.dat"
plot BASENAME."-perf.dat" using (IX(column(MPARM), column(NPARM), XN)):FLOPS smooth unique
unset table
set table BASENAME."-perf-mbw.dat"
plot BASENAME."-perf.dat" using MEMBW:(1.0) smooth cumulative
unset table
set table BASENAME."-perf-cdf.dat"
plot BASENAME."-perf.dat" using FLOPS:(1.0) smooth cumulative
unset table
stats BASENAME."-perf-cdf.dat" using (("".strcol(3)."" eq "i")?($2):(1/0)) nooutput; FREQSUM = STATS_max; FREQN = STATS_records

if (MULTI==1) {
  set output FILENAME
}

FILEEXT = system("sh -c \"echo ".FILENAME." | sed 's/.\\+\\.\\(.\\+\\)/\\1/'\"")
set terminal FILEEXT
set termoption enhanced
#set termoption font ",12"
save_encoding = GPVAL_ENCODING
set encoding utf8

reset
if (MULTI<=0) { set output "".FILECOUNT."-".FILENAME; FILECOUNT = FILECOUNT + 1 }
if (MULTI>-1) { set title "Performance" }
set origin -0.03, 0
set pm3d interpolate 0, 0
#set colorbox horizontal user origin 0, 0.1 size 1, 0.1
#set autoscale fix
if (0<HIM) { set xrange [*:HIM] }
if (0<HIN) { set yrange [*:HIN] }
if (0<HIK) { set zrange [*:HIK] }
if (0>HIM) { set xrange [*:MNK] }
if (0>HIN) { set yrange [*:MNK] }
if (0>HIK) { set zrange [*:MNK] }
set xlabel "M"
set ylabel "N" offset -3.0
set zlabel "K" offset 1.0
set ticslevel 0
set cblabel "GFLOP/s" offset 1.5
set format x "%g"; set format y "%g"; set format z "%g"; set format cb "%g"
splot BASENAME."-perf.dat" using MPARM:NPARM:KPARM:FLOPS notitle with points pointtype 7 linetype palette

reset
if (MULTI<=0) { set output "".FILECOUNT."-".FILENAME; FILECOUNT = FILECOUNT + 1 }
if (MULTI>-1) { set title "Performance (K-Average)" }
set origin -0.02, 0
set dgrid3d #9, 9
set pm3d interpolate 0, 0 map
set autoscale fix
set xlabel "M"
set ylabel "N" offset -1.5
set cblabel "GFLOP/s" offset 0.5
set format x "%g"; set format y "%g"; set format cb "%g"
set mxtics 2
splot BASENAME."-perf-avg.dat" using (("".strcol(3)."" eq "i")?(I1($1, XN)):(1/0)):(("".strcol(3)."" eq "i")?(J1($1, XN)):(1/0)):2 notitle with pm3d

reset
if (MULTI<=0) { set output "".FILECOUNT."-".FILENAME; FILECOUNT = FILECOUNT + 1 }
if (MULTI>-1) { set title "Performance (Average per Bin)" }
set style fill solid 0.4 noborder
set boxwidth 0.5
set grid y2tics linecolor "grey"
unset key
unset xtics
set xtics ("MNK <= 13^3" 0, "13^3 < MNK <= 23^3" 1, "23^3 < MNK" 2) scale 0 offset 0, 0.2
set x2tics ("Small" 0, "Medium" 1, "Larger" 2) scale 0
set xlabel "Problem Size (MNK)"
set ytics format ""
set y2tics nomirror
set y2label "GFLOP/s"
set xrange [-0.5:2.5]
plot  BASENAME."-perf.dat" \
      using (0.0):((NFLOPS(MPARM,NPARM,KPARM)<=XFLOPS(13,13,13))?column(FLOPS):1/0) notitle smooth unique with boxes linetype 1 linecolor "grey", \
  ""  using (1.0):(((XFLOPS(13,13,13)<NFLOPS(MPARM,NPARM,KPARM))&&(NFLOPS(MPARM,NPARM,KPARM)<=XFLOPS(23,23,23)))?column(FLOPS):1/0) notitle smooth unique with boxes linetype 1 linecolor "grey", \
  ""  using (2.0):((XFLOPS(23,23,23)<NFLOPS(MPARM,NPARM,KPARM))?column(FLOPS):1/0) notitle smooth unique with boxes linetype 1 linecolor "grey"

reset
if (MULTI<=0) { set output "".FILECOUNT."-".FILENAME; FILECOUNT = FILECOUNT + 1 }
if (MULTI>-1) { set title "Performance and Memory Bandwidth (CDF)" }
set xlabel "Probability\n\n{/=8 Minimum: ".sprintf(ACC, MINFLOPS)." GFLOP/s  Geo. Mean: ".sprintf(ACC, GEO)." GFLOP/s  Median: ".sprintf(ACC, MED)." GFLOP/s  Maximum: ".sprintf(ACC, MAXFLOPS)." GFLOP/s}"
set ylabel "GB/s"
set y2label "GFLOP/s"
set format x "%g%%"
set format y "%g"
set format y2 "%g"
set ytics nomirror
set y2tics nomirror
set grid x y2 linecolor "grey"
set xrange [0:100]
set yrange [0:*]
set y2range [0:*]
set fit quiet
f(x) = b * x + a
fit f(x) BASENAME."-perf-cdf.dat" using (("".strcol(3)."" eq "i")?(100*$2/FREQSUM):(1/0)):1 via a, b
g(x) = (x - a) / b
x50 = 0.5 * (100 + MAX(0, g(0)))
h(x) = d * x + c
dx = 100 / FREQN
fit [x50-1.5*dx:x50+1.5*dx] h(x) BASENAME."-perf-cdf.dat" using (("".strcol(3)."" eq "i")?(100*$2/FREQSUM):(1/0)):1 via c, d
set arrow from x50, second h(x50) to x50, second 0 front
set arrow from x50, second h(x50) to 100, second h(x50) front
set label sprintf("%.0f%%", x50) at x50, second 0.5 * h(x50) left offset 1 front
set label sprintf(ACC." GFLOP/s", h(x50)) at 0.5 * (x50 + 100.0), second h(x50) centre offset 0, -1 front
set key left invert
plot  BASENAME."-perf-mbw.dat" using (("".strcol(3)."" eq "i")?(100*$2/FREQSUM):(1/0)):1 axes x1y1 title "Memory Bandwidth" with lines linecolor "grey", \
      BASENAME."-perf-cdf.dat" using (("".strcol(3)."" eq "i")?(100*$2/FREQSUM):(1/0)):1 axes x1y2 title "Compute Performance" with lines linewidth 2

reset
if (MULTI<=0) { set output "".FILECOUNT."-".FILENAME; FILECOUNT = FILECOUNT + 1 }
if (MULTI>-1) { set title "Performance and Arithmetic Intensity" }
set grid x y2 linecolor "grey"
set key left #spacing 0.5
set ytics format ""
set y2tics nomirror
set y2label "GFLOP/s"
set xlabel "FLOPS/Byte"
plot  BASENAME."-perf.dat" using (AI(MPARM,NPARM,KPARM,8)):FLOPS notitle smooth sbezier with lines linecolor "grey", \
                        "" using (AI(MPARM,NPARM,KPARM,8)):FLOPS notitle smooth unique with points pointtype 7 pointsize 0.1