change: use gettimeofday function for calculating cost value.
add: tools/memcheck.c has been added.
change: build target tools/memcheck has added to Makefile.
change: should return 1 after luaL_checktype for understandability reasons.