Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
9cbb97f3
Commit
9cbb97f3
authored
Sep 23, 2010
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tdb: add mktdb tool.
parent
7a36f69e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
ccan/tdb/tools/Makefile
ccan/tdb/tools/Makefile
+1
-1
ccan/tdb/tools/mktdb.c
ccan/tdb/tools/mktdb.c
+29
-0
No files found.
ccan/tdb/tools/Makefile
View file @
9cbb97f3
...
...
@@ -2,7 +2,7 @@ LDLIBS:=../../tdb.o ../../hash.o
CFLAGS
:=
-I
../../..
-Wall
-O3
#-g -pg
LDFLAGS
:=
-L
../../..
default
:
replay_trace tdbtorture tdbdump tdbtool starvation
default
:
replay_trace tdbtorture tdbdump tdbtool starvation
mktdb
benchmark
:
replay_trace
@
trap
"rm -f /tmp/trace.
$$$$
"
0
;
for
f
in
benchmarks/
*
.rz
;
do if
runzip
-k
$$
f
-o
/tmp/trace.
$$$$
&&
echo
-n
"
$$
f"
:
&&
./replay_trace
--quiet
-n
5 replay.tdb /tmp/trace.
$$$$
&&
rm
/tmp/trace.
$$$$
;
then
rm
-f
/tmp/trace.
$$$$
;
else
exit
1
;
fi
;
done
...
...
ccan/tdb/tools/mktdb.c
0 → 100644
View file @
9cbb97f3
#include <ccan/tdb/tdb.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <err.h>
int
main
(
int
argc
,
char
*
argv
[])
{
unsigned
int
i
,
num_recs
;
struct
tdb_context
*
tdb
;
if
(
argc
!=
3
||
(
num_recs
=
atoi
(
argv
[
2
]))
==
0
)
errx
(
1
,
"Usage: mktdb <tdbfile> <numrecords>"
);
tdb
=
tdb_open
(
argv
[
1
],
10007
,
TDB_DEFAULT
,
O_CREAT
|
O_TRUNC
|
O_RDWR
,
0600
);
if
(
!
tdb
)
err
(
1
,
"Opening %s"
,
argv
[
1
]);
for
(
i
=
0
;
i
<
num_recs
;
i
++
)
{
TDB_DATA
d
;
d
.
dptr
=
(
void
*
)
&
i
;
d
.
dsize
=
sizeof
(
i
);
if
(
tdb_store
(
tdb
,
d
,
d
,
TDB_INSERT
)
!=
0
)
err
(
1
,
"Failed to store record %i"
,
i
);
}
printf
(
"Done
\n
"
);
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment