Пример #1
0
  def _StartProfiling(self):
    """Starts profiling."""
    if not self._processing_configuration:
      return

    if self._processing_configuration.profiling.HaveProfileMemory():
      identifier = u'{0:s}-memory'.format(self._name)
      self._memory_profiler = profiler.GuppyMemoryProfiler(
          identifier, path=self._processing_configuration.profiling.directory,
          profiling_sample_rate=(
              self._processing_configuration.profiling.sample_rate))
      self._memory_profiler.Start()

    if self._processing_configuration.profiling.HaveProfileParsers():
      identifier = u'{0:s}-parsers'.format(self._name)
      self._parsers_profiler = profiler.ParsersProfiler(
          identifier, path=self._processing_configuration.profiling.directory)
      self._extraction_worker.SetParsersProfiler(self._parsers_profiler)

    if self._processing_configuration.profiling.HaveProfileProcessing():
      identifier = u'{0:s}-processing'.format(self._name)
      self._processing_profiler = profiler.ProcessingProfiler(
          identifier, path=self._processing_configuration.profiling.directory)
      self._extraction_worker.SetProcessingProfiler(self._processing_profiler)

    if self._processing_configuration.profiling.HaveProfileSerializers():
      identifier = u'{0:s}-serializers'.format(self._name)
      self._serializers_profiler = profiler.SerializersProfiler(
          identifier, path=self._processing_configuration.profiling.directory)
Пример #2
0
    def _StartProfiling(self):
        """Starts profiling."""
        if not self._enable_profiling:
            return

        if self._profiling_type in (u'all', u'memory'):
            identifier = u'{0:s}-memory'.format(self._name)
            self._memory_profiler = profiler.GuppyMemoryProfiler(
                identifier,
                path=self._profiling_directory,
                profiling_sample_rate=self._profiling_sample_rate)
            self._memory_profiler.Start()

        if self._profiling_type in (u'all', u'parsers'):
            identifier = u'{0:s}-parsers'.format(self._name)
            self._parsers_profiler = profiler.ParsersProfiler(
                identifier, path=self._profiling_directory)
            self._extraction_worker.SetParsersProfiler(self._parsers_profiler)

        if self._profiling_type in (u'all', u'processing'):
            identifier = u'{0:s}-processing'.format(self._name)
            self._processing_profiler = profiler.ProcessingProfiler(
                identifier, path=self._profiling_directory)
            self._extraction_worker.SetProcessingProfiler(
                self._processing_profiler)

        if self._profiling_type in (u'all', u'serializers'):
            identifier = u'{0:s}-serializers'.format(self._name)
            self._serializers_profiler = profiler.SerializersProfiler(
                identifier, path=self._profiling_directory)