Changeset 52906

Show
Ignore:
Timestamp:
07/23/08 23:04:05 (1 month ago)
Author:
bdelbosc
Message:

switch report from python-gdchart to python-gdchart2

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • funkload/trunk/CHANGES.txt

    r52902 r52906  
    2323 
    2424:Target: 1.8.0 
     25 
     26New features 
     27~~~~~~~~~~~~ 
     28 
     29* Upgrate to python-gdchart2 using libgd2 (gdchart1 is deprecated). 
    2530 
    2631 
  • funkload/trunk/funkload/ReportRenderer.py

    r48817 r52906  
    2323try: 
    2424    import gdchart 
     25    # Check python-gdchart2 
     26    from gdchart import GDChartError 
    2527    g_has_gdchart = 1 
    2628except ImportError: 
     
    659661            cvus.append(str(test.cvus)) 
    660662        color_error = has_error and self.color_error or self.color_bg 
    661         gdchart.option(format=gdchart.GDC_PNG, 
    662                        set_color=(self.color_success, self.color_success), 
    663                        vol_color=self.color_error, 
    664                        bg_color=self.color_bg, plot_color=self.color_plot, 
    665                        line_color=self.color_line, 
    666                        title='Successful Tests Per Second', xtitle='CUs', 
    667                        ylabel_fmt='%.2f', ylabel2_fmt='%.2f %%', 
    668                        ytitle='STPS', ytitle2="Errors", 
    669                        ylabel_density=50, 
    670                        ytitle2_color=color_error, ylabel2_color=color_error, 
    671                        requested_ymin=0.0) 
    672         gdchart.chart(gdchart.GDC_3DCOMBO_LINE_BAR, 
    673                       self.getChartSize(cvus), 
    674                       image_path, 
    675                       cvus, stps, errors) 
     663        x = gdchart.LineBarCombo3D() 
     664        x.title = 'Successful Tests Per Second' 
     665        x.xtitle = 'CUs' 
     666        x.ylabel_fmt = '%.2f' 
     667        x.ylabel2_fmt = '%.2f %%' 
     668        x.ytitle = 'STPS' 
     669        x.ytitle2 = "Errors" 
     670        x.ylabel_density = 50 
     671        x.ytitle2_color = color_error 
     672        x.ylabel2_color = color_error 
     673        x.requested_ymin = 0.0 
     674 
     675        x.set_color = (self.color_success, self.color_success) 
     676        x.vol_color = self.color_error 
     677        x.bg_color = self.color_bg 
     678        x.plot_color=self.color_plot 
     679        x.line_color = self.color_line 
     680        x.width, x.height = self.getChartSize(cvus) 
     681        x.setLabels(cvus) 
     682        x.setData(stps) 
     683        x.setComboData(errors) 
     684        x.draw(image_path) 
     685 
    676686 
    677687    def appendDelays(self, delay, delay_low, delay_high, stats): 
     
    685695            delay_low.append(stats.min) 
    686696            delay_high.append(stats.max) 
    687     
     697 
    688698    def getYTitle(self): 
    689699        if self.options.with_percentiles: 
     
    715725 
    716726        color_error = has_error and self.color_error or self.color_bg 
    717         gdchart.option(format=gdchart.GDC_PNG, 
    718                        set_color=(self.color_time_min_max, 
    719                                   self.color_time_min_max, self.color_time), 
    720                        vol_color=self.color_error, 
    721                        bg_color=self.color_bg, plot_color=self.color_plot, 
    722                        grid_color=self.color_grid, 
    723                        line_color=self.color_line, 
    724                        title='Page response time', xtitle='CUs', 
    725                        ylabel_fmt='%.2fs', ylabel2_fmt='%.2f %%', 
    726                        ytitle=self.getYTitle(), ytitle2="Errors", 
    727                        ylabel_density=50, 
    728                        hlc_style=gdchart.GDC_HLC_I_CAP+gdchart. 
    729                        GDC_HLC_CONNECTING, 
    730                        ytitle2_color=color_error, ylabel2_color=color_error, 
    731                        requested_ymin=0.0) 
    732         gdchart.chart(gdchart.GDC_3DCOMBO_HLC_BAR, 
    733                       self.getChartSize(cvus), 
    734                       image_path, 
    735                       cvus, (delay_high, delay_low, delay), errors) 
    736         gdchart.option(format=gdchart.GDC_PNG, 
    737                        set_color=(self.color_success, self.color_success), 
    738                        vol_color=self.color_error, 
    739                        bg_color=self.color_bg, plot_color=self.color_plot, 
    740                        line_color=self.color_line, 
    741                        title='Successful Pages Per Second', xtitle='CUs', 
    742                        ylabel_fmt='%.2f', ylabel2_fmt='%.2f %%', 
    743                        ytitle='SPPS', ytitle2="Errors", 
    744                        ylabel_density=50, 
    745                        requested_ymin=0.0) 
    746         gdchart.chart(gdchart.GDC_3DCOMBO_LINE_BAR, 
    747                       self.getChartSize(cvus), 
    748                       image2_path, 
    749                       cvus, spps, errors) 
     727        x = gdchart.HLCBarCombo3D() 
     728        x.set_color=(self.color_time_min_max, self.color_time_min_max, self.color_time) 
     729        x.vol_color=self.color_error 
     730        x.bg_color=self.color_bg 
     731        x.plot_color=self.color_plot 
     732        x.grid_color=self.color_grid 
     733        x.line_color=self.color_line 
     734        x.title='Page response time' 
     735        x.xtitle='CUs' 
     736        x.ylabel_fmt='%.2fs' 
     737        x.ylabel2_fmt='%.2f %%' 
     738        x.ytitle=self.getYTitle() 
     739        x.ytitle2="Errors" 
     740        x.ylabel_density=50 
     741        x.hlc_style = ("I_CAP", "CONNECTING") 
     742        x.ytitle2_color = color_error 
     743        x.ylabel2_color = color_error 
     744        x.requested_ymin = 0.0 
     745        x.width, x.height = self.getChartSize(cvus) 
     746        x.setLabels(cvus) 
     747        x.setData((delay_high, delay_low, delay)) 
     748        x.setComboData(errors) 
     749        x.draw(image_path) 
     750 
     751        x = gdchart.LineBarCombo3D() 
     752        x.set_color = (self.color_success, self.color_success) 
     753        x.vol_color=self.color_error 
     754        x.bg_color=self.color_bg 
     755        x.plot_color=self.color_plot 
     756        x.line_color=self.color_line 
     757        x.title='Successful Pages Per Second' 
     758        x.xtitle='CUs' 
     759        x.ylabel_fmt='%.2f' 
     760        x.ylabel2_fmt='%.2f %%' 
     761        x.ytitle='SPPS' 
     762        x.ytitle2="Errors" 
     763        x.ylabel_density=50 
     764        x.requested_ymin=0.0 
     765        x.width, x.height = self.getChartSize(cvus) 
     766        x.setLabels(cvus) 
     767        x.setData(spps) 
     768        x.setComboData(errors) 
     769        x.draw(image2_path) 
    750770 
    751771 
     
    773793 
    774794        color_error = has_error and self.color_error or self.color_bg 
    775         gdchart.option(format=gdchart.GDC_PNG, 
    776                        set_color=(self.color_time_min_max, 
    777                                   self.color_time_min_max, self.color_time), 
    778                        vol_color=self.color_error, 
    779                        bg_color=self.color_bg, plot_color=self.color_plot, 
    780                        grid_color=self.color_grid, 
    781                        line_color=self.color_line, 
    782                        title='Request response time', xtitle='CUs', 
    783                        ylabel_fmt='%.2fs', ylabel2_fmt='%.2f %%', 
    784                        ytitle=self.getYTitle(), ytitle2="Errors", 
    785                        ylabel_density=50, 
    786                        hlc_style=gdchart.GDC_HLC_I_CAP+gdchart. 
    787                        GDC_HLC_CONNECTING, 
    788                        ytitle2_color=color_error, ylabel2_color=color_error, 
    789                        requested_ymin=0.0) 
    790         gdchart.chart(gdchart.GDC_3DCOMBO_HLC_BAR, 
    791                       self.getChartSize(cvus), 
    792                       image_path, 
    793                       cvus, (delay_high, delay_low, delay), errors) 
    794  
    795         gdchart.option(format=gdchart.GDC_PNG, 
    796                        set_color=(self.color_success, self.color_success), 
    797                        vol_color=self.color_error, 
    798                        bg_color=self.color_bg, plot_color=self.color_plot, 
    799                        line_color=self.color_line, 
    800                        title='Requests Per Second', xtitle='CUs', 
    801                        ylabel_fmt='%.2f', ylabel2_fmt='%.2f %%', 
    802                        ytitle='RPS', ytitle2="Errors", 
    803                        ylabel_density=50, 
    804                        ytitle2_color=color_error, ylabel2_color=color_error, 
    805                        requested_ymin=0.0) 
    806         gdchart.chart(gdchart.GDC_3DCOMBO_LINE_BAR, 
    807                       self.getChartSize(cvus), 
    808                       image2_path, 
    809                       cvus, rps, errors) 
     795 
     796        x = gdchart.HLCBarCombo3D() 
     797        x.set_color = (self.color_time_min_max, 
     798                       self.color_time_min_max, self.color_time) 
     799        x.vol_color = self.color_error 
     800        x.bg_color=self.color_bg 
     801        x.plot_color=self.color_plot 
     802        x.grid_color=self.color_grid 
     803        x.line_color=self.color_line 
     804        x.title='Request response time' 
     805        x.xtitle='CUs' 
     806        x.ylabel_fmt='%.2fs' 
     807        x.ylabel2_fmt='%.2f %%' 
     808        x.ytitle=self.getYTitle() 
     809        x.ytitle2="Errors" 
     810        x.ylabel_density=50 
     811        x.hlc_style = ("I_CAP", "CONNECTING") 
     812        x.ytitle2_color=color_error 
     813        x.ylabel2_color=color_error 
     814        x.requested_ymin=0.0 
     815        x.width, x.height = self.getChartSize(cvus) 
     816        x.setLabels(cvus) 
     817        x.setData((delay_high, delay_low, delay)) 
     818        x.setComboData(errors) 
     819        x.draw(image_path) 
     820 
     821        x = gdchart.LineBarCombo3D() 
     822        x.set_color=(self.color_success, self.color_success) 
     823        x.vol_color=self.color_error 
     824        x.bg_color=self.color_bg 
     825        x.plot_color=self.color_plot 
     826        x.line_color=self.color_line 
     827        x.title='Requests Per Second' 
     828        x.xtitle='CUs' 
     829        x.ylabel_fmt='%.2f' 
     830        x.ylabel2_fmt='%.2f %%' 
     831        x.ytitle='RPS' 
     832        x.ytitle2="Errors" 
     833        x.ylabel_density=50 
     834        x.ytitle2_color=color_error 
     835        x.ylabel2_color=color_error 
     836        x.requested_ymin=0.0 
     837        x.width, x.height = self.getChartSize(cvus) 
     838        x.setLabels(cvus) 
     839        x.setData(rps) 
     840        x.setComboData(errors) 
     841        x.draw(image2_path) 
    810842 
    811843 
     
    840872        title = str('Request %s response time' % step) 
    841873        color_error = has_error and self.color_error or self.color_bg 
    842         gdchart.option(format=gdchart.GDC_PNG, 
    843                        set_color=(self.color_time_min_max, 
    844                                   self.color_time_min_max, self.color_time), 
    845                        vol_color=self.color_error, 
    846                        bg_color=self.color_bg, plot_color=self.color_plot, 
    847                        grid_color=self.color_grid, 
    848                        line_color=self.color_line, 
    849                        title=title, xtitle='CUs', 
    850                        ylabel_fmt='%.2fs', ylabel2_fmt='%.2f %%', 
    851                        ytitle=self.getYTitle(), ytitle2="Errors", 
    852                        ylabel_density=50, 
    853                        hlc_style=gdchart.GDC_HLC_I_CAP+gdchart. 
    854                        GDC_HLC_CONNECTING, 
    855                        ytitle2_color=color_error, ylabel2_color=color_error, 
    856                        requested_ymin=0.0) 
    857         gdchart.chart(gdchart.GDC_3DCOMBO_HLC_BAR, 
    858                       self.getChartSize(cvus), 
    859                       image_path, 
    860                       cvus, (delay_high, delay_low, delay), errors) 
     874 
     875        x = gdchart.HLCBarCombo3D() 
     876        x.set_color=(self.color_time_min_max, 
     877                     self.color_time_min_max, self.color_time) 
     878        x.vol_color=self.color_error 
     879        x.bg_color=self.color_bg 
     880        x.plot_color=self.color_plot 
     881        x.grid_color=self.color_grid 
     882        x.line_color=self.color_line 
     883        x.title=title 
     884        x.xtitle='CUs' 
     885        x.ylabel_fmt='%.2fs' 
     886        x.ylabel2_fmt='%.2f %%' 
     887        x.ytitle=self.getYTitle() 
     888        x.ytitle2="Errors" 
     889        x.ylabel_density=50 
     890        x.hlc_style = ("I_CAP", "CONNECTING") 
     891        x.ytitle2_color=color_error 
     892        x.ylabel2_color=color_error 
     893        x.requested_ymin=0.0 
     894        x.width, x.height = self.getChartSize(cvus) 
     895        x.setLabels(cvus) 
     896        x.setData((delay_high, delay_low, delay)) 
     897        x.setComboData(errors) 
     898        x.draw(image_path) 
     899 
    861900 
    862901    # monitoring charts 
     
    877916        for stat in stats: 
    878917            test, cycle, cvus = stat.key.split(':') 
    879             times.append(str('%ss / %s CUs' % ( 
    880                 int(float(stat.time) - time_start), cvus))) 
     918            # Limit size to 11 as 12 core dump glibc python: free() on feisty 
     919            times.append(str('%ss-%sCUs' % ( 
     920                int(float(stat.time) - time_start), cvus))[:11]) 
    881921 
    882922        mem_total = int(stats[0].memTotal) 
     
    936976        title = str('%s: cpu usage (green 1=100%%) and loadavg 1(red), ' 
    937977                    '5 and 15 min' % host) 
    938         gdchart.option(format=gdchart.GDC_PNG, 
    939                        set_color=(0x00ff00, 0xff0000, 0x0000ff), 
    940                        vol_color=0xff0000, 
    941                        bg_color=self.color_bg, plot_color=self.color_plot, 
    942                        line_color=self.color_line, 
    943                        title=title, 
    944                        xtitle='time and CUs', 
    945                        ylabel_fmt='%.2f', 
    946                        ytitle='loadavg', 
    947                        ylabel_density=50, 
    948                        requested_ymin=0.0) 
    949         gdchart.chart(gdchart.GDC_LINE, self.big_chart_size, 
    950                       image_path, 
    951                       times, cpu_usage, load_avg_1, load_avg_5, load_avg_15) 
     978        x = gdchart.Line() 
     979        x.set_color=(0x00ff00, 0xff0000, 0x0000ff) 
     980        x.vol_color=0xff0000 
     981        x.bg_color=self.color_bg 
     982        x.plot_color=self.color_plot 
     983        x.line_color=self.color_line 
     984        x.title=title 
     985        x.xtitle='time and CUs' 
     986        x.ylabel_fmt='%.2f' 
     987        x.ytitle='loadavg' 
     988        x.ylabel_density=50 
     989        x.requested_ymin=0.0 
     990        x.width, x.height = self.big_chart_size 
     991        x.setLabels(times) 
     992        x.setData(cpu_usage, load_avg_1, load_avg_5, load_avg_15) 
     993        x.draw(image_path) 
    952994 
    953995        title = str('%s memory (green) and swap (red) usage' % host) 
    954996        image_path = str(os.path.join(self.report_dir, '%s_mem.png' % host)) 
    955         gdchart.option(format=gdchart.GDC_PNG, 
    956                        title=title, 
    957                        ylabel_fmt='%.0f kB', 
    958                        ytitle='memory used kB') 
    959         gdchart.chart(gdchart.GDC_LINE, self.big_chart_size, 
    960                       image_path, 
    961                       times, mem_used, swap_used) 
     997        x = gdchart.Line() 
     998        x.title = title 
     999        x.ylabel_fmt='%.0f kB' 
     1000        x.ytitle='memory used kB' 
     1001        x.set_color=(0x00ff00, 0xff0000, 0x0000ff) 
     1002        x.vol_color=0xff0000 
     1003        x.bg_color=self.color_bg 
     1004        x.plot_color=self.color_plot 
     1005        x.line_color=self.color_line 
     1006        x.title=title 
     1007        x.xtitle='time and CUs' 
     1008        x.width, x.height = self.big_chart_size 
     1009        x.setLabels(times) 
     1010        x.setData(mem_used, swap_used) 
     1011        x.draw(image_path) 
    9621012 
    9631013        title = str('%s network in (green)/out (red)' % host) 
    9641014        image_path = str(os.path.join(self.report_dir, '%s_net.png' % host)) 
    965         gdchart.option(format=gdchart.GDC_PNG, 
    966                        title=title, 
    967                        ylabel_fmt='%.0f kB/s', 
    968                        ytitle='network') 
    969         gdchart.chart(gdchart.GDC_LINE, self.big_chart_size, 
    970                       image_path, 
    971                       times, net_in, net_out) 
     1015        x = gdchart.Line() 
     1016        x.title = title 
     1017        x.ylabel_fmt='%.0f kB/s' 
     1018        x.ytitle='network' 
     1019        x.set_color=(0x00ff00, 0xff0000, 0x0000ff) 
     1020        x.vol_color=0xff0000 
     1021        x.bg_color=self.color_bg 
     1022        x.plot_color=self.color_plot 
     1023        x.line_color=self.color_line 
     1024        x.title=title 
     1025        x.xtitle='time and CUs' 
     1026        x.width, x.height = self.big_chart_size 
     1027        x.setLabels(times) 
     1028        x.setData(net_in, net_out) 
     1029        x.draw(image_path)