Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
少年别单纯
battery-historian
提交
4bbbac5a
B
battery-historian
项目概览
少年别单纯
/
battery-historian
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
battery-historian
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
4bbbac5a
编写于
6月 25, 2014
作者:
P
Paul Eastham
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Sync with internal version 31.
上级
47748947
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
8 deletion
+22
-8
historian.py
historian.py
+22
-8
未找到文件。
historian.py
浏览文件 @
4bbbac5a
...
...
@@ -94,8 +94,11 @@ def parse_time(s, fmt):
return
ret
def
time_float_to_human
(
t
):
return
time
.
strftime
(
"%H:%M:%S"
,
time
.
localtime
(
t
))
def
time_float_to_human
(
t
,
show_complete_time
):
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
):
...
...
@@ -256,7 +259,9 @@ def swap(swap_list, first, second):
def
add_emit_event
(
emit_dict
,
cat
,
name
,
start
,
end
):
newevent
=
(
name
,
int
(
start
),
int
(
end
))
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
:
if
getopt_debug
:
print
"Stored emitted event: %s<br>"
%
str
(
newevent
)
...
...
@@ -307,6 +312,9 @@ def parse_argv():
print
str
(
err
)
usage
()
if
not
argv_rest
:
usage
()
return
argv_rest
...
...
@@ -534,6 +542,7 @@ class LegacyFormatConverter(object):
return
header
def
convert
(
self
,
input_file
):
"""Convert legacy format file into string that fits latest format."""
output_string
=
""
history_start
=
False
...
...
@@ -598,6 +607,7 @@ class BHEmitter(object):
print
"store_event: %s in %s/%s<br>"
%
(
event_str
,
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
:
try
:
result
=
self
.
_in_progress_dict
[
cat
].
pop
(
subcat
)
...
...
@@ -651,6 +661,7 @@ class BHEmitter(object):
return
name
def
abbreviate_event_name
(
self
,
name
):
"""Abbreviate location-related event name."""
if
not
getopt_show_all_wakelocks
:
if
"wake_lock"
in
name
:
if
"LocationManagerService"
in
name
or
"NlpWakeLock"
in
name
:
...
...
@@ -833,7 +844,7 @@ class BlameSynopsis(object):
self
.
_duration_list
.
append
(
duration
)
self
.
mah
+=
mah
if
not
self
.
timestr
:
self
.
timestr
=
time_float_to_human
(
t
)
self
.
timestr
=
time_float_to_human
(
t
,
False
)
def
get_count
(
self
):
return
len
(
self
.
_duration_list
)
...
...
@@ -1095,7 +1106,7 @@ def main():
printer
=
Printer
()
print
"""
<!DOCTY
L
E html>
<!DOCTY
P
E html>
<html>
<head>
"""
...
...
@@ -1174,8 +1185,11 @@ width:100px;
</head>
<body>
"""
start_localtime
=
time_float_to_human
(
data_start_time
)
stop_localtime
=
time_float_to_human
(
data_stop_time
)
show_complete_time
=
False
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. '
'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
...
...
@@ -1195,7 +1209,7 @@ width:100px;
print
"</ul>Showing result for %s"
%
bhemitter
.
match_list
[
0
]
print
(
"<pre>(Local time %s - %s, %dm elapsed)</pre>"
%
(
start_localtime
,
stop_localtime
,
(
data_stop_time
-
data_start_time
)
/
60
))
(
data_stop_time
-
data_start_time
)
/
60
))
print
(
"<p>
\n
"
"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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录