Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
scmperf
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mercurial
scmperf
Commits
91acabfefa62
Commit
91acabfefa62
authored
6 years ago
by
Pierre-Yves David
Browse files
Options
Downloads
Plain Diff
branching: merge with other head
parents
701cfea993d7
4822078e81b4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
benchmarks/basic_commands.py
+32
-7
32 additions, 7 deletions
benchmarks/basic_commands.py
benchmarks/utils.py
+17
-0
17 additions, 0 deletions
benchmarks/utils.py
with
49 additions
and
7 deletions
benchmarks/basic_commands.py
+
32
−
7
View file @
91acabfe
...
...
@@ -16,8 +16,13 @@
import
urllib
import
pipes
from
.utils
import
(
BaseNChangesetsTestSuite
,
BaseTestSuite
,
median
,
REPOS_DIR
)
from
.utils
import
(
BaseNChangesetsTestSuite
,
BaseTestSuite
,
params_as_kwargs
,
median
,
REPOS_DIR
)
if
sys
.
version_info
[
0
]
==
2
:
import
Queue
as
queue
...
...
@@ -40,5 +45,9 @@
timeout
=
120
def
track_commit
(
self
,
*
args
,
**
kwargs
):
params
=
BaseTestSuite
.
params
+
[(
"
create
"
,
"
update
"
)]
param_names
=
BaseTestSuite
.
param_names
+
[
"
mode
"
]
@params_as_kwargs
def
track_commit
(
self
,
mode
,
**
kwargs
):
timings
=
[]
...
...
@@ -44,2 +53,3 @@
timings
=
[]
filename
=
None
...
...
@@ -45,5 +55,12 @@
with
open
(
os
.
path
.
join
(
self
.
repo_path
,
'
BABAR
'
),
'
w
'
)
as
f
:
f
.
write
(
"
BABAR
"
)
self
.
hg
(
'
status
'
)
if
mode
==
'
create
'
:
with
open
(
os
.
path
.
join
(
self
.
repo_path
,
'
BABAR
'
),
'
w
'
)
as
f
:
f
.
write
(
"
BABAR
"
)
else
:
# pick filename to update
filename
=
self
.
hg
(
'
manifest
'
).
partition
(
'
\n
'
)[
0
]
filename
=
os
.
path
.
join
(
self
.
repo_path
,
filename
)
# Do the commits N time
...
...
@@ -48,4 +65,4 @@
# Do the commits N time
for
i
in
range
(
3
):
for
i
in
range
(
10
):
try
:
...
...
@@ -51,2 +68,9 @@
try
:
if
mode
==
'
update
'
:
with
open
(
filename
,
'
a
'
)
as
target
:
target
.
write
(
'
The quick brown fox jumps over the lazy dog
\n
'
)
else
:
self
.
hg
(
'
add
'
,
'
BABAR
'
)
before
=
time
.
time
()
...
...
@@ -52,8 +76,8 @@
before
=
time
.
time
()
self
.
hg
(
'
commit
'
,
'
-A
'
,
'
-m
'
,
'
My commit message
'
,
self
.
hg
(
'
commit
'
,
'
-m
'
,
'
My commit message
'
,
'
-u
'
,
'
<test@octobus.net>
'
)
after
=
time
.
time
()
timings
.
append
(
after
-
before
)
finally
:
# Rollback and clean
self
.
hg
(
'
rollback
'
,
'
--config
'
,
'
ui.rollback=true
'
)
...
...
@@ -54,9 +78,10 @@
'
-u
'
,
'
<test@octobus.net>
'
)
after
=
time
.
time
()
timings
.
append
(
after
-
before
)
finally
:
# Rollback and clean
self
.
hg
(
'
rollback
'
,
'
--config
'
,
'
ui.rollback=true
'
)
self
.
hg
(
'
debugupdatecache
'
)
self
.
hg
(
'
update
'
,
'
-C
'
,
'
.
'
)
return
median
(
timings
)
...
...
This diff is collapsed.
Click to expand it.
benchmarks/utils.py
+
17
−
0
View file @
91acabfe
from
__future__
import
print_function
import
json
import
functools
import
os
import
os.path
import
re
...
...
@@ -115,6 +116,22 @@
return
sum
(
sorted
(
lst
)[
quotient
-
1
:
quotient
+
1
])
/
2.
def
params_as_kwargs
(
f
):
"""
Pass in test parameters as keyword arguments.
Use as a decorator on BaseTestSuite methods
"""
@functools.wraps
(
f
)
def
wrapper
(
self
,
*
args
,
**
kwargs
):
names
=
self
.
param_names
args
,
values
=
args
[
len
(
names
):],
args
[:
len
(
names
)]
kwargs
.
update
(
zip
(
names
,
values
))
return
f
(
self
,
*
args
,
**
kwargs
)
return
wrapper
class
BaseTestSuite
(
object
):
params
=
[
REPOS
]
...
...
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