1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
9 class TimeProfile(object):
10 """Class for simple profiling of action, with logging of cost."""
12 def __init__(self
, description
):
13 self
._starttime
= None
14 self
._description
= description
18 self
._starttime
= time
.time()
21 """Stop profiling and dump a log."""
23 stoptime
= time
.time()
24 logging
.info('%fsec to perform %s',
25 stoptime
- self
._starttime
, self
._description
)
26 self
._starttime
= None