Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mini-gunicorn
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
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
Kevin Lyda
mini-gunicorn
Commits
689eae37
Commit
689eae37
authored
8 years ago
by
Kevin Lyda
Browse files
Options
Downloads
Patches
Plain Diff
More test changes.
parent
35979308
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
peek.py
+35
-0
35 additions, 0 deletions
peek.py
ruby/Gemfile
+5
-0
5 additions, 0 deletions
ruby/Gemfile
ruby/Gemfile.lock
+19
-0
19 additions, 0 deletions
ruby/Gemfile.lock
ruby/test.rb
+8
-0
8 additions, 0 deletions
ruby/test.rb
with
67 additions
and
0 deletions
peek.py
0 → 100755
+
35
−
0
View file @
689eae37
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
from
__future__
import
unicode_literals
"""
Test script to peek in db files.
"""
import
struct
import
os
import
mmap
filename
=
'
metrics/gauge_livesum_40272.db
'
f
=
open
(
filename
,
'
a+b
'
)
capacity
=
os
.
fstat
(
f
.
fileno
()).
st_size
m
=
mmap
.
mmap
(
f
.
fileno
(),
capacity
)
used
=
struct
.
unpack_from
(
b
'
i
'
,
m
,
0
)[
0
]
pos
=
8
while
pos
<
used
:
encoded_len
=
struct
.
unpack_from
(
b
'
i
'
,
m
,
pos
)[
0
]
pos
+=
4
encoded
=
struct
.
unpack_from
(
'
{0}s
'
.
format
(
encoded_len
).
encode
(),
m
,
pos
)[
0
]
padded_len
=
encoded_len
+
(
8
-
(
encoded_len
+
4
)
%
8
)
pos
+=
padded_len
value
=
struct
.
unpack_from
(
b
'
d
'
,
m
,
pos
)[
0
]
print
(
"
Entry: %s = %d
"
%
(
encoded
,
value
))
pos
+=
8
f
.
close
()
print
(
"
Capacity %s
"
%
capacity
)
print
(
"
Used %d
"
%
used
)
This diff is collapsed.
Click to expand it.
ruby/Gemfile
0 → 100644
+
5
−
0
View file @
689eae37
# frozen_string_literal: true
source
"https://rubygems.org"
gem
'mmap'
,
git:
'https://github.com/lyda/mmap.git'
,
:branch
=>
'non-global-version'
#gem 'mmap', :path => '/Users/kevin/src/p4g/mmap'
This diff is collapsed.
Click to expand it.
ruby/Gemfile.lock
0 → 100644
+
19
−
0
View file @
689eae37
GIT
remote: https://github.com/lyda/mmap.git
revision: 379bdbd2c848e96d8f89e954663b8c26529b8919
branch: non-global-version
specs:
mmap (0.2.7)
GEM
remote: https://rubygems.org/
specs:
PLATFORMS
ruby
DEPENDENCIES
mmap!
BUNDLED WITH
1.14.3
This diff is collapsed.
Click to expand it.
ruby/test.rb
0 → 100644
+
8
−
0
View file @
689eae37
require
'mmap'
mmap
=
Mmap
.
new
(
__FILE__
)
mmap
.
advise
(
Mmap
::
MADV_SEQUENTIAL
)
mmap
.
each
do
|
line
|
puts
line
end
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