Extend existing profiler options dictionary with delay_ms. delay_ms delays the start of a profiler session by that many milliseconds.

PiperOrigin-RevId: 338120876
Change-Id: Idc3707286a286d88f170b828e4e985ce0518b8d7
This commit is contained in:
Yi Situ 2020-10-20 13:06:29 -07:00 committed by TensorFlower Gardener
parent 3cf23c75bc
commit a7d75e16d3
2 changed files with 17 additions and 5 deletions

View File

@ -48,9 +48,10 @@ _profiler_lock = threading.Lock()
@tf_export('profiler.experimental.ProfilerOptions', v1=[])
class ProfilerOptions(
collections.namedtuple(
'ProfilerOptions',
['host_tracer_level', 'python_tracer_level', 'device_tracer_level'])):
collections.namedtuple('ProfilerOptions', [
'host_tracer_level', 'python_tracer_level', 'device_tracer_level',
'delay_ms'
])):
"""Options for finer control over the profiler.
Use `tf.profiler.ProfilerOptions` to control `tf.profiler`
@ -63,15 +64,22 @@ class ProfilerOptions(
- enabled, 0 - disabled [default value is 0]
device_tracer_level: Adjust device (TPU/GPU) tracing level. Values are: 1 -
enabled, 0 - disabled [default value is 1]
delay_ms: Requests for all hosts to start profiling at a timestamp that is
`delay_ms` away from the current time. `delay_ms` is in milliseconds. If
zero, each host will start profiling immediately upon receiving the
request. Default value is None, allowing the profiler guess the best
value.
"""
def __new__(cls,
host_tracer_level=2,
python_tracer_level=0,
device_tracer_level=1):
device_tracer_level=1,
delay_ms=None):
return super(ProfilerOptions,
cls).__new__(cls, host_tracer_level, python_tracer_level,
device_tracer_level)
device_tracer_level, delay_ms)
@tf_export('profiler.experimental.start', v1=[])

View File

@ -3,6 +3,10 @@ tf_class {
is_instance: "<class \'tensorflow.python.profiler.profiler_v2.ProfilerOptions\'>"
is_instance: "<class \'tensorflow.python.profiler.profiler_v2.ProfilerOptions\'>"
is_instance: "<type \'tuple\'>"
member {
name: "delay_ms"
mtype: "<type \'property\'>"
}
member {
name: "device_tracer_level"
mtype: "<type \'property\'>"