summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5b0d311)
The Makefile is adapted to make possible to pass arguments to an arbitrary
benchmark program.
P_LD = @echo ' LD $@';
P_PLOT = @echo ' PLOT $@';
P_MAKE = @echo ' MAKE $@';
P_LD = @echo ' LD $@';
P_PLOT = @echo ' PLOT $@';
P_MAKE = @echo ' MAKE $@';
-P_RUN = @echo ' RUN $<';
+P_RUN = @echo ' RUN $< $(arg1) $(arg2) $(arg3)';
P_AWK = @echo ' AWK $@';
endif
P_AWK = @echo ' AWK $@';
endif
.PRECIOUS: $(STAT_DIR)/%.c.csv $(STAT_DIR)/%.a.csv
$(STAT_DIR)/%.c.csv $(STAT_DIR)/%.a.csv: $(BIN_DIR)/%
.PRECIOUS: $(STAT_DIR)/%.c.csv $(STAT_DIR)/%.a.csv
$(STAT_DIR)/%.c.csv $(STAT_DIR)/%.a.csv: $(BIN_DIR)/%
$P mv gc-collections.csv $(STAT_DIR)/$*.c.csv
$P mv gc-mallocs.csv $(STAT_DIR)/$*.a.csv
$P mv gc-collections.csv $(STAT_DIR)/$*.c.csv
$P mv gc-mallocs.csv $(STAT_DIR)/$*.a.csv
+# special command line arguments for benchmarks
+$(STAT_DIR)/split.c.csv $(STAT_DIR)/split.a.csv: override args := bible.txt
.PRECIOUS: $(STAT_DIR)/%.h.csv
$(STAT_DIR)/%.h.csv: $(STAT_DIR)/%.a.csv
.PRECIOUS: $(STAT_DIR)/%.h.csv
$(STAT_DIR)/%.h.csv: $(STAT_DIR)/%.a.csv
import tango.util.Convert: to;
int main(char[][] args) {
import tango.util.Convert: to;
int main(char[][] args) {
- auto txt = cast(byte[]) File.get("bible.txt");
- auto n = (args.length > 1) ? to!(uint)(args[1]) : 1;
- if (n < 1) n = 1;
+ if (args.length < 2)
+ return 1;
+ auto txt = cast(byte[]) File.get(args[1]);
+ auto n = (args.length > 2) ? to!(uint)(args[2]) : 1;
+ if (n < 1)
+ n = 1;
while (--n)
txt ~= txt;
auto words = delimit!(byte)(txt, cast(byte[]) " \t\n\r");
while (--n)
txt ~= txt;
auto words = delimit!(byte)(txt, cast(byte[]) " \t\n\r");