Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sjrpc
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
sjrpc
Commits
71728e39
You need to sign in or sign up before continuing.
Commit
71728e39
authored
13 years ago
by
Matthieu Gonnet
Committed by
Seblu
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add time command
parent
80c6bf0f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cccli/commands/time.py
+34
-0
34 additions, 0 deletions
cccli/commands/time.py
with
34 additions
and
0 deletions
cccli/commands/time.py
0 → 100644
+
34
−
0
View file @
71728e39
#!/usr/bin/env python
#coding=utf8
'''
CloudControl time command
'''
import
time
as
systime
import
datetime
from
cccli.exception
import
*
from
sjrpc.core.exceptions
import
*
from
cccli.printer
import
Printer
,
color
from
cccli.command
import
Command
class
Command_time
(
Command
):
'''
Show execution time
'''
def
__init__
(
self
,
cli
,
argv0
):
Command
.
__init__
(
self
,
cli
,
argv0
)
def
__call__
(
self
,
argv
):
if
len
(
argv
)
>
1
:
# Substitute aliases
self
.
args
=
self
.
cli
.
aliases
.
substitute
(
argv
[
1
:])
# Init time
t0
=
systime
.
time
()
# Execute command
self
.
cli
.
commands
(
self
.
args
)
t1
=
systime
.
time
()
# Get elapsed time
dt
=
int
(
t1
-
t0
)
print
"
Execution time: %s
"
%
datetime
.
timedelta
(
seconds
=
dt
)
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