コード例 #1
0
ファイル: performance_plot.py プロジェクト: HackLinux/ioreth
def plotPerformanceData(csvLike, titleTemplate, outputTemplate, targetColumn, yLabel,
                        patternMap, params, scale=Decimal(1.0), xRange='*:*', debug=False):
                        
  """
  params :: [(pattern :: str, bsU :: str, yRange :: str|None)]
      list of parameters.
  
  """
  assert(isinstance(csvLike, CsvLike))
  assert(isinstance(titleTemplate, str))
  assert(isinstance(outputTemplate, str))
  assert(isinstance(targetColumn, str))
  assert(isinstance(yLabel, str))
  assert(isinstance(patternMap, dict))
  assert(isinstance(params, list))
  assert(isinstance(scale, Decimal))
  assert(isinstance(xRange, str))
  assert(isinstance(debug, bool))
  
  for pattern, blockSizeU, yRange in params:
    title = titleTemplate % (patternMap[pattern], blockSizeU)
    output = outputTemplate % (pattern, blockSizeU)
    blockSizeS = str(util.u2s(blockSizeU))
    if yRange is None:
      yRange = '0:*'
    rp = PerformancePlot(csvLike, pattern, blockSizeS,
                         targetColumn, yLabel, title, output,
                         scale, xRange, yRange, debug)
    rp.plot()
コード例 #2
0
def plotMultiData(relColLegList,
                  titleTemplate,
                  outputTemplate,
                  yLabel,
                  patternMap,
                  params,
                  scale=Decimal(1.0),
                  xRange='*:*',
                  debug=False):
    """
  relColLegList :: [(rel, col, legend)]
    rel :: Relation
    col :: str
      target column name
    legend :: str
      legend title in the plot.
    Each legend must be unique in the list.
  
  params :: [(pattern :: str, mode :: str, bsU :: str, yRange :: str|None)]
      list of parameters.
  
  """
    assert (isinstance(relColLegList, list))
    assert (isinstance(titleTemplate, str))
    assert (isinstance(outputTemplate, str))
    assert (isinstance(yLabel, str))
    assert (isinstance(patternMap, dict))
    assert (isinstance(params, list))
    assert (isinstance(scale, Decimal))
    assert (isinstance(xRange, str))
    assert (isinstance(debug, bool))

    for pattern, mode, bsU, yRange in params:
        title = titleTemplate % (patternMap[pattern], mode, bsU)
        output = outputTemplate % (pattern, mode, bsU)
        bsS = str(util.u2s(bsU))
        if yRange is None:
            yRange = '0:*'
        rp = MultiPlot(relColLegList, pattern, mode, bsS, yLabel, title,
                       output, scale, xRange, yRange, debug)
        rp.plot()

    pass
コード例 #3
0
ファイル: performance_multi.py プロジェクト: HackLinux/ioreth
def plotMultiData(relColLegList, titleTemplate, outputTemplate,
                  yLabel, patternMap,
                  params, scale=Decimal(1.0), xRange='*:*', debug=False):
  """
  relColLegList :: [(rel, col, legend)]
    rel :: Relation
    col :: str
      target column name
    legend :: str
      legend title in the plot.
    Each legend must be unique in the list.
  
  params :: [(pattern :: str, mode :: str, bsU :: str, yRange :: str|None)]
      list of parameters.
  
  """
  assert(isinstance(relColLegList, list))
  assert(isinstance(titleTemplate, str))
  assert(isinstance(outputTemplate, str))
  assert(isinstance(yLabel, str))
  assert(isinstance(patternMap, dict))
  assert(isinstance(params, list))
  assert(isinstance(scale, Decimal))
  assert(isinstance(xRange, str))
  assert(isinstance(debug, bool))

  if len(params) == 0:
    raise "params list is empty."

  for pattern, mode, bsU, yRange in params:
    title = titleTemplate % (patternMap[pattern], mode, bsU)
    output = outputTemplate % (pattern, mode, bsU)
    bsS = str(util.u2s(bsU))
    if yRange is None:
      yRange = '0:*'
    rp = MultiPlot(relColLegList, pattern, mode, bsS,
                   yLabel, title, output,
                   scale, xRange, yRange, debug)
    rp.plot()
  
  pass
コード例 #4
0
ファイル: performance_plot.py プロジェクト: herumi/ioreth
def plotPerformanceData(csvLike,
                        titleTemplate,
                        outputTemplate,
                        targetColumn,
                        yLabel,
                        patternMap,
                        params,
                        scale=Decimal(1.0),
                        xRange='*:*',
                        debug=False):
    """
  params :: [(pattern :: str, bsU :: str, yRange :: str|None)]
      list of parameters.
  
  """
    assert (isinstance(csvLike, CsvLike))
    assert (isinstance(titleTemplate, str))
    assert (isinstance(outputTemplate, str))
    assert (isinstance(targetColumn, str))
    assert (isinstance(yLabel, str))
    assert (isinstance(patternMap, dict))
    assert (isinstance(params, list))
    assert (isinstance(scale, Decimal))
    assert (isinstance(xRange, str))
    assert (isinstance(debug, bool))

    for pattern, blockSizeU, yRange in params:
        title = titleTemplate % (patternMap[pattern], blockSizeU)
        output = outputTemplate % (pattern, blockSizeU)
        blockSizeS = str(util.u2s(blockSizeU))
        if yRange is None:
            yRange = '0:*'
        rp = PerformancePlot(csvLike, pattern, blockSizeS, targetColumn,
                             yLabel, title, output, scale, xRange, yRange,
                             debug)
        rp.plot()
コード例 #5
0
ファイル: expr.py プロジェクト: herumi/ioreth
 def setBsU(self, bsU):
     assert(isinstance(bsU, str))
     assert(isinstance(util.u2s(bsU), int))
     self.__bsU = bsU
     self.__bs = util.u2s(bsU)
コード例 #6
0
ファイル: param.py プロジェクト: herumi/ioreth
 def blockSizeUnitListCheck(self):
     self.checkParamList('blockSizeUnitList', str)
     for bsU in self.blockSizeUnitList():
         bs = util.u2s(bsU)
         checkAndThrow(isinstance(bs, int), 'bs must be int.')
         checkAndThrow(bs > 0, 'bs must > 0.')
コード例 #7
0
ファイル: plot_histogram.py プロジェクト: herumi/ioreth
                  for bsU in blockSizeUnitList for nth in nThreadsList
                  for width in widthList]

    def histogramG(f):
        for line in f:
            rec = line.rstrip().split()
            yield (Decimal(rec[0]), int(rec[1]))

    for plotDir, outDir in zip(plotDirList, outDirList):

        if not os.path.exists(outDir):
            os.makedirs(outDir)

        for pattern, mode, bsU, nth, width in paramsList:
            fn = '%s/%s/%s/%s/%s/histogram_%s' % \
                (plotDir, pattern, mode, nth, str(util.u2s(bsU)), width)
            title = 'Histogram with %s %s, blocksize %s, nThreads %s, width %s' % \
                (patternMap[pattern], mode, bsU, nth, width)
            outputFile = outFileTemplate % (pattern, mode, bsU, nth, width)
            output = "%s/%s" % (outDir, outputFile)
            f = open(fn)
            hp = HistogramPlot(histogramG(f),
                               width,
                               title,
                               output,
                               debug=False)
            hp.plot()
            f.close()


if __name__ == "__main__":
コード例 #8
0
 def blockSizeUnitListCheck(self):
     self.checkParamList('blockSizeUnitList', str)
     for bsU in self.blockSizeUnitList():
         bs = util.u2s(bsU)
         checkAndThrow(isinstance(bs, int), 'bs must be int.')
         checkAndThrow(bs > 0, 'bs must > 0.')
コード例 #9
0
ファイル: plot_histogram.py プロジェクト: HackLinux/ioreth
  paramsList = [(pattern, mode, bsU, nth, width)
                for (pattern, mode) in patternModeList
                for bsU in blockSizeUnitList
                for nth in nThreadsList
                for width in widthList]
  
  def histogramG(f):
    for line in f:
      rec = line.rstrip().split()
      yield (Decimal(rec[0]), int(rec[1]))
  
  for plotDir, outDir in zip(plotDirList, outDirList):

    if not os.path.exists(outDir):
      os.makedirs(outDir)
    
    for pattern, mode, bsU, nth, width in paramsList:
      fn = '%s/%s/%s/%s/%s/histogram_%s' % \
          (plotDir, pattern, mode, nth, str(util.u2s(bsU)), width)
      title = 'Histogram with %s %s, blocksize %s, nThreads %s, width %s' % \
          (patternMap[pattern], mode, bsU, nth, width)
      outputFile = outFileTemplate % (pattern, mode, bsU, nth, width)
      output = "%s/%s" % (outDir, outputFile)
      f = open(fn)
      hp = HistogramPlot(histogramG(f), width, title, output, debug=False)
      hp.plot()
      f.close()
  
if __name__ == "__main__":
  doMain()