Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
traincam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
42loop
traincam
Commits
4fdbf579
Commit
4fdbf579
authored
6 years ago
by
42loop
Browse files
Options
Downloads
Patches
Plain Diff
first (late) commit
parent
8cfdc545
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
showstats.py
+21
-2
21 additions, 2 deletions
showstats.py
with
21 additions
and
2 deletions
showstats.py
+
21
−
2
View file @
4fdbf579
...
@@ -44,11 +44,30 @@ def db_dump():
...
@@ -44,11 +44,30 @@ def db_dump():
cur
.
execute
(
"
SELECT * FROM trains
"
)
cur
.
execute
(
"
SELECT * FROM trains
"
)
rows
=
cur
.
fetchall
()
rows
=
cur
.
fetchall
()
train_time
=
0
last_et_stamp
=
0
last_st_stamp
=
0
for
row
in
rows
:
for
row
in
rows
:
#print(row[1])
#print(row[1])
st
=
datetime
.
datetime
.
fromtimestamp
(
float
(
row
[
1
])
-
7200.0
)
#.strftime('%Y-%m-%d %H:%M:%S'))
st_stamp
=
float
(
row
[
1
])
-
7200.0
print
(
st
,
float
(
row
[
2
])
*
1000000
)
if
st_stamp
>
last_et_stamp
+
45
:
st
=
datetime
.
datetime
.
fromtimestamp
(
last_st_stamp
)
#.strftime('%Y-%m-%d %H:%M:%S'))
et
=
datetime
.
datetime
.
fromtimestamp
(
last_et_stamp
)
if
train_time
>
2
:
#print(st," to ", et," train_time: ",train_time)
print
(
str
(
last_st_stamp
)
+
"
,%.2f
"
%
train_time
)
#print("----------------new train")
last_st_stamp
=
st_stamp
train_time
=
0
train_time
+=
float
(
row
[
2
])
et_stamp
=
float
(
row
[
1
])
-
7200.0
+
float
(
row
[
2
])
st
=
datetime
.
datetime
.
fromtimestamp
(
st_stamp
)
#.strftime('%Y-%m-%d %H:%M:%S'))
et
=
datetime
.
datetime
.
fromtimestamp
(
et_stamp
)
#print(st,float(row[2]),et)
last_et_stamp
=
et_stamp
def
db_create
():
def
db_create
():
global
con
global
con
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment