diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000..7070f0a --- /dev/null +++ b/test/Makefile @@ -0,0 +1,32 @@ +SRC_DIR = . +OBJ_DIR = ./obj +BIN_DIR = ./bin +MKDIR = mkdir -p + +CC = g++ +CFLAGS = -Wall -Wfatal-errors -std=c++11 -I${CONDA_PREFIX}/include -I${CONDA_PREFIX}/include/cpp_h5_writer +LDFLAGS = -L${CONDA_PREFIX}/lib -L/usr/lib64 -lcpp_h5_writer -lzmq -lhdf5 -lhdf5_hl -lhdf5_cpp -lhdf5_hl_cpp -lboost_system -lboost_regex -lboost_thread -lpthread + +HEADERS = $(wildcard $(SRC_DIR)/*.hpp) +SRCS = $(wildcard $(SRC_DIR)/*.cpp) +OBJS = $(patsubst $(SRC_DIR)/%.cpp, $(OBJ_DIR)/%.o, $(SRCS)) + +h5_write_perf: export LD_LIBRARY_PATH=${CONDA_PREFIX}/lib +h5_write_perf: CFLAGS += -DDEBUG_OUTPUT -g +h5_write_perf: lib build_dirs $(OBJS) + $(CC) $(LDFLAGS) -o $(BIN_DIR)/h5_write_perf $(OBJS) $(LDFLAGS) + +lib: + $(MAKE) -C ../lib deploy + +deploy: h5_write_perf + cp bin/* ${CONDA_PREFIX}/bin + +$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp + $(CC) $(CFLAGS) $(LDFLAGS) -c -o $@ $< + +build_dirs: + $(MKDIR) $(OBJ_DIR) $(BIN_DIR) + +clean: + rm -rf $(OBJ_DIR) $(BIN_DIR) \ No newline at end of file diff --git a/test/h5_write_perf.cpp b/test/h5_write_perf.cpp new file mode 100644 index 0000000..cbe1d9a --- /dev/null +++ b/test/h5_write_perf.cpp @@ -0,0 +1,50 @@ +#include +#include +#include + +#include "H5Writer.hpp" + +using namespace std; + +int main (int argc, char *argv[]) +{ + if (argc != 5) { + cout << endl; + cout << "Usage: h5_write_perf [output_file] [n_frames] [frame_size_x] [frame_size_y]" << endl; + cout << "\toutput_file: Name of the output file." << endl; + cout << "\tn_frames: Number of images to write." << endl; + cout << "\frame_size_x: Frame width in pixels." << endl; + cout << "\frame_size_y: Frame height in pixels." << endl; + cout << endl; + + exit(-1); + } + + string output_file = string(argv[1]); + int n_frames = atoi(argv[2]); + int frame_size_x = atoi(argv[3]); + int frame_size_y = atoi(argv[4]); + + H5Writer writer(output_file, n_frames, n_frames, n_frames); + + size_t buffer_length = frame_size_x * frame_size_y * sizeof(u_int16_t); + char* buffer = new char[buffer_length]; + + string dataset_name = "data"; + + for (size_t index=0; index