提交 4bbbac5a 编写于 作者: P Paul Eastham

Sync with internal version 31.

上级 47748947
...@@ -94,8 +94,11 @@ def parse_time(s, fmt): ...@@ -94,8 +94,11 @@ def parse_time(s, fmt):
return ret return ret
def time_float_to_human(t): def time_float_to_human(t, show_complete_time):
return time.strftime("%H:%M:%S", time.localtime(t)) if show_complete_time:
return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(t))
else:
return time.strftime("%H:%M:%S", time.localtime(t))
def abbrev_timestr(s): def abbrev_timestr(s):
...@@ -256,7 +259,9 @@ def swap(swap_list, first, second): ...@@ -256,7 +259,9 @@ def swap(swap_list, first, second):
def add_emit_event(emit_dict, cat, name, start, end): def add_emit_event(emit_dict, cat, name, start, end):
newevent = (name, int(start), int(end)) newevent = (name, int(start), int(end))
if end < start: if end < start:
print "BUG: end time before start time:<br>" % str(newevent) print "BUG: end time before start time: %s %s %s<br>" % (name,
start,
end)
else: else:
if getopt_debug: if getopt_debug:
print "Stored emitted event: %s<br>" % str(newevent) print "Stored emitted event: %s<br>" % str(newevent)
...@@ -307,6 +312,9 @@ def parse_argv(): ...@@ -307,6 +312,9 @@ def parse_argv():
print str(err) print str(err)
usage() usage()
if not argv_rest:
usage()
return argv_rest return argv_rest
...@@ -534,6 +542,7 @@ class LegacyFormatConverter(object): ...@@ -534,6 +542,7 @@ class LegacyFormatConverter(object):
return header return header
def convert(self, input_file): def convert(self, input_file):
"""Convert legacy format file into string that fits latest format."""
output_string = "" output_string = ""
history_start = False history_start = False
...@@ -598,6 +607,7 @@ class BHEmitter(object): ...@@ -598,6 +607,7 @@ class BHEmitter(object):
print "store_event: %s in %s/%s<br>" % (event_str, cat, subcat) print "store_event: %s in %s/%s<br>" % (event_str, cat, subcat)
def retrieve_event(self, cat, subcat): def retrieve_event(self, cat, subcat):
"""Pop event from in-progress event dict if match exists."""
if cat in self._in_progress_dict: if cat in self._in_progress_dict:
try: try:
result = self._in_progress_dict[cat].pop(subcat) result = self._in_progress_dict[cat].pop(subcat)
...@@ -651,6 +661,7 @@ class BHEmitter(object): ...@@ -651,6 +661,7 @@ class BHEmitter(object):
return name return name
def abbreviate_event_name(self, name): def abbreviate_event_name(self, name):
"""Abbreviate location-related event name."""
if not getopt_show_all_wakelocks: if not getopt_show_all_wakelocks:
if "wake_lock" in name: if "wake_lock" in name:
if "LocationManagerService" in name or "NlpWakeLock" in name: if "LocationManagerService" in name or "NlpWakeLock" in name:
...@@ -833,7 +844,7 @@ class BlameSynopsis(object): ...@@ -833,7 +844,7 @@ class BlameSynopsis(object):
self._duration_list.append(duration) self._duration_list.append(duration)
self.mah += mah self.mah += mah
if not self.timestr: if not self.timestr:
self.timestr = time_float_to_human(t) self.timestr = time_float_to_human(t, False)
def get_count(self): def get_count(self):
return len(self._duration_list) return len(self._duration_list)
...@@ -1095,7 +1106,7 @@ def main(): ...@@ -1095,7 +1106,7 @@ def main():
printer = Printer() printer = Printer()
print """ print """
<!DOCTYLE html> <!DOCTYPE html>
<html> <html>
<head> <head>
""" """
...@@ -1174,8 +1185,11 @@ width:100px; ...@@ -1174,8 +1185,11 @@ width:100px;
</head> </head>
<body> <body>
""" """
start_localtime = time_float_to_human(data_start_time) show_complete_time = False
stop_localtime = time_float_to_human(data_stop_time) if data_stop_time - data_start_time > 24 * 60 * 60:
show_complete_time = True
start_localtime = time_float_to_human(data_start_time, show_complete_time)
stop_localtime = time_float_to_human(data_stop_time, show_complete_time)
print ('<div id="chart"><b>WARNING: Visualizer disabled. ' print ('<div id="chart"><b>WARNING: Visualizer disabled. '
'If you see this message, download the HTML then open it.</b></div>') 'If you see this message, download the HTML then open it.</b></div>')
if "wake_lock_in" not in emit_dict and (getopt_power_data_file if "wake_lock_in" not in emit_dict and (getopt_power_data_file
...@@ -1195,7 +1209,7 @@ width:100px; ...@@ -1195,7 +1209,7 @@ width:100px;
print "</ul>Showing result for %s" % bhemitter.match_list[0] print "</ul>Showing result for %s" % bhemitter.match_list[0]
print ("<pre>(Local time %s - %s, %dm elapsed)</pre>" print ("<pre>(Local time %s - %s, %dm elapsed)</pre>"
% (start_localtime, stop_localtime, % (start_localtime, stop_localtime,
(data_stop_time-data_start_time)/60)) (data_stop_time-data_start_time) / 60))
print ("<p>\n" print ("<p>\n"
"Zoom: <input id=\"scale\" type=\"text\" value=\"100%\"></input>" "Zoom: <input id=\"scale\" type=\"text\" value=\"100%\"></input>"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册