예제 #1
0
    def testTracingControlDisabledInChildButNotInParent(self):
        def child(resp):
            # test tracing is not controllable in the child
            resp.put(trace_event.is_tracing_controllable())

        with self._test_trace():
            q = multiprocessing.Queue()
            p = multiprocessing.Process(target=child, args=[q])
            p.start()
            # test tracing is controllable in the parent
            self.assertTrue(trace_event.is_tracing_controllable())
            self.assertFalse(q.get())
            p.join()
예제 #2
0
  def StartAgentTracing(self, config, timeout):
    self._is_tracing_controllable = trace_event.is_tracing_controllable()
    if not self._is_tracing_controllable:
      return False

    tf = tempfile.NamedTemporaryFile(delete=False)
    self._trace_log = tf.name
    tf.close()
    del config # unused
    del timeout # unused
    assert not trace_event.trace_is_enabled(), 'Tracing already running.'
    trace_event.trace_enable(self._trace_log)
    assert trace_event.trace_is_enabled(), 'Tracing didn\'t enable properly.'
    return True
예제 #3
0
 def _IsTracingControllable(self):
   return trace_event.is_tracing_controllable()
예제 #4
0
 def child(resp):
     # test tracing is not controllable in the child
     resp.put(trace_event.is_tracing_controllable())
예제 #5
0
# found in the LICENSE file.
import unittest

from telemetry.internal.results import page_test_results
from telemetry.internal.platform.tracing_agent import telemetry_tracing_agent
from telemetry.testing import test_stories
from tracing.trace_data import trace_data

from py_trace_event import trace_event


def GetEventNames(trace):
    return (e['name'] for e in trace['traceEvents'])


@unittest.skipUnless(trace_event.is_tracing_controllable(),
                     'py_trace_event is not supported')
class TelemetryTracingAgentTest(unittest.TestCase):
    def setUp(self):
        platform = None  # Does not actually need one.
        self.config = None  # Does not actually need one.
        self.agent = telemetry_tracing_agent.TelemetryTracingAgent(
            platform, self.config)

    def tearDown(self):
        if self.agent.is_tracing:
            self.agent.StopAgentTracing()

    def testAddTraceEvent(self):
        self.agent.StartAgentTracing(self.config, timeout=10)
        with trace_event.trace('test-marker'):
예제 #6
0
 def IsSupported(cls, platform_backend):
     del platform_backend  # Unused.
     return trace_event.is_tracing_controllable()
 def IsSupported(cls, platform_backend):
   del platform_backend  # Unused.
   return trace_event.is_tracing_controllable()