Skip to content

Commit 3190a52

Browse files
committed
update
1 parent ab7b528 commit 3190a52

File tree

2 files changed

+109
-0
lines changed

2 files changed

+109
-0
lines changed

Makefile

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
all:
2+
3+
##############################
4+
OBJS+=out/buf.o
5+
out/buf.o:src/buf.c
6+
7+
CEXES+=cov/buf_t
8+
cov/buf_t:src/buf_t.c src/buf.c
9+
10+
COVS+=cov/buf.c.cov
11+
cov/buf.c.cov:cov/buf_t
12+
13+
##############################
14+
OBJS+=out/toaster.o
15+
out/toaster.o:src/toaster.c
16+
17+
##############################
18+
OBJS+=out/config.o
19+
out/config.o:src/config.c
20+
21+
CEXES+=cov/config_t
22+
cov/config_t:src/config_t.c src/config.c out/toaster.o
23+
24+
COVS+=cov/config.c.cov
25+
cov/config.c.cov:cov/config_t
26+
27+
##############################
28+
#rules
29+
all:$(OBJS) $(COVS)
30+
31+
clean:
32+
rm -rf out cov *.gcno *.gcda *.gcov
33+
34+
CFLAGS+=-Iinc -fPIC -g -Wall -Werror -O3 -std=c99 -fvisibility=hidden -ffunction-sections
35+
36+
DEP_FLAGS=-MMD -MP -MF $(@:%=%.d)
37+
LD_FLAGS=-Wl,--gc-sections
38+
39+
OBJ_DEPS=$(OBJS:%=%.d)
40+
-include $(OBJ_DEPS)
41+
42+
$(OBJS):
43+
@mkdir -p $(@D)
44+
$(CC) -o $@ -c $(filter %.c, $^) $(CFLAGS) $(DEP_FLAGS)
45+
46+
EXE_DEPS=$(EXES:%=%.d)
47+
-include $(EXE_DEPS)
48+
49+
$(EXES):
50+
@mkdir -p $(@D)
51+
$(CC) -o $@ $^ $(CFLAGS) $(DEP_FLAGS)
52+
53+
DLL_DEPS=$(DLLS:%=%.d)
54+
-include $(DLL_DEPS)
55+
56+
$(DLLS):
57+
mkdir -p $(@D)
58+
$(CC) -o $@ $^ $(CFLAGS) -shared -ldl $(DEP_FLAGS)
59+
60+
export GCOV_PREFIX=cov
61+
export GCOV_PREFIX_STRIP=$(words $(subst /, ,$(PWD)))
62+
$(COVS):
63+
@mkdir -p $(@D)
64+
$<
65+
mv *.gcno $(@D)/ || echo ok
66+
gcov -r -c -b -o $(@D) $(notdir $(@:%.cov=%)) | tee $<.cov.out
67+
mv *.gcov $(@D)/ || echo ok
68+
@grep "Branches executed:100" $<.cov.out
69+
@grep "Lines executed:100" $<.cov.out
70+
touch $@
71+
72+
CEXE_DEPS=$(CEXES:%=%.d)
73+
-include $(CEXE_DEPS)
74+
75+
$(CEXES):
76+
@mkdir -p $(@D)
77+
$(CC) -o $@ $(filter-out %.h, $^) $(DEP_FLAGS) $(LD_FLAGS) $(CFLAGS) -fsanitize=address -fsanitize=leak -fsanitize=undefined -coverage -ldl -DTOASTER
78+
79+
$$%:;@$(call true)$(info $(call or,$$$*))

src/loom.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#define _FILE_OFFSET_BITS 64
2+
#define _GNU_SOURCE
3+
#include <stdlib.h>
4+
#include <stdint.h>
5+
#include <string.h>
6+
#include <assert.h>
7+
#include <limits.h>
8+
#include <fcntl.h>
9+
#include <unistd.h>
10+
#include <pthread.h>
11+
12+
#include <sys/time.h>
13+
#include <sys/types.h>
14+
#include <sys/stat.h>
15+
#include <sys/fcntl.h>
16+
17+
//#define SHOW_DEBUG
18+
#include "err.h"
19+
20+
#define TSIZE (512*1024*1024*1024llu)
21+
#define QSIZE (512*1024)
22+
//read packets from the network
23+
//verify the signatures
24+
//fetch all the data
25+
//do all the account transfers
26+
//write all the data
27+
//compute the merkle
28+
//sequence all the transactions
29+
int main(int _argc, char * const _argv[]) {
30+
}

0 commit comments

Comments
 (0)