From 2d7995a8a721a4ed83618e9d431cfc8288f88271 Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Tue, 10 Jul 2012 11:21:17 -0500 Subject: [PATCH] Update to Lua 5.2 --- .gitignore | 3 +++ Makefile.darwin | 2 +- Makefile.linux | 2 +- Makefile.win | 2 +- README | 6 +++--- config.darwin | 2 +- config.linux | 2 +- config.win | 8 ++++---- src/analyzer/summary.lua | 4 ++-- src/core_profiler.h | 1 + src/lua50_profiler.c | 4 ++-- 11 files changed, 20 insertions(+), 16 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9a11a51 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.o +/bin/ +/src/TAGS diff --git a/Makefile.darwin b/Makefile.darwin index 61df6ec..ba225b5 100755 --- a/Makefile.darwin +++ b/Makefile.darwin @@ -9,5 +9,5 @@ clean: rm -f $(PROFILER_OUTPUT) src/*.o install: - install -m 0755 $(PROFILER_OUTPUT) /usr/local/lib/lua/5.1 + install -m 0755 $(PROFILER_OUTPUT) /usr/local/lib/lua/5.2 diff --git a/Makefile.linux b/Makefile.linux index 0a2c2c9..49a00e9 100755 --- a/Makefile.linux +++ b/Makefile.linux @@ -10,5 +10,5 @@ clean: rm -f $(PROFILER_OUTPUT) src/*.o install: - install -m 0755 $(PROFILER_OUTPUT) /usr/local/lib/lua/5.1 + install -m 0755 $(PROFILER_OUTPUT) /usr/local/lib/lua/5.2 diff --git a/Makefile.win b/Makefile.win index 3304422..cd09ce5 100755 --- a/Makefile.win +++ b/Makefile.win @@ -1,7 +1,7 @@ # $Id: Makefile.win,v 1.8 2007-08-22 17:45:56 carregal Exp $ T= profiler -V= 2.0.1 +V= 2.1.0 include config.win diff --git a/README b/README index 13375b8..e128f9f 100755 --- a/README +++ b/README @@ -8,9 +8,9 @@ and their respective running times. You can use this log to generate a summary o functions your program uses, along with how long it stayed in each of them, or you can import the log into a spreadsheet for further analysis. -LuaProfiler is free software and uses the same license as Lua 5.1. +LuaProfiler is free software and uses the same license as Lua 5.2. -Current version is 2.0.2. It was developed for Lua 5.1. +Current version is 2.1.0. It was developed for Lua 5.2. LuaProfiler can be downloaded from the LuaForge page, or from LuaRocks ("luarocks install luaprofiler"). @@ -19,6 +19,6 @@ Installation LuaProfiler source is distributed as a group of C files and some makefile templates. -LuaProfiler follows the package model for Lua 5.1, therefore it should be "installed" in your package.path. +LuaProfiler follows the package model for Lua 5.2, therefore it should be "installed" in your package.path. Windows users can use the pre-compiled version of LuaProfiler (profiler.dll) available at LuaForge. diff --git a/config.darwin b/config.darwin index 5dd041d..eded93c 100755 --- a/config.darwin +++ b/config.darwin @@ -1,5 +1,5 @@ -LUA_INCLUDE= /usr/local/include/lua51 +LUA_INCLUDE= /usr/local/include/lua52 PROFILER_OUTPUT= bin/profiler.so diff --git a/config.linux b/config.linux index 5dd041d..9b162cc 100755 --- a/config.linux +++ b/config.linux @@ -1,5 +1,5 @@ -LUA_INCLUDE= /usr/local/include/lua51 +LUA_INCLUDE= /usr/include/lua5.2 PROFILER_OUTPUT= bin/profiler.so diff --git a/config.win b/config.win index f5ad0ec..d273676 100755 --- a/config.win +++ b/config.win @@ -1,10 +1,10 @@ # Installation directories # System's libraries directory (where binary libraries are installed) -LUA_LIBDIR= c:\lua5.1 +LUA_LIBDIR= c:\lua5.2 # Lua includes directory -LUA_INC= c:\lua5.1\include +LUA_INC= c:\lua5.2\include # Lua library -LUA_LIB= c:\lua5.1\lua5.1.lib +LUA_LIB= c:\lua5.2\lua5.2.lib LIBNAME= $T.dll @@ -14,4 +14,4 @@ INCS= /I$(LUA_INC) CFLAGS= $(WARN) $(INCS) CC= cl -# $Id: config.win,v 1.8 2007-08-22 17:45:56 carregal Exp $ \ No newline at end of file +# $Id: config.win,v 1.8 2007-08-22 17:45:56 carregal Exp $ diff --git a/src/analyzer/summary.lua b/src/analyzer/summary.lua index daa5459..3bbbe2f 100755 --- a/src/analyzer/summary.lua +++ b/src/analyzer/summary.lua @@ -36,7 +36,7 @@ function CreateSummary(lines, summary) local global_time = 0 -- Note: ignore first line - for i = 2, table.getn(lines) do + for i = 2, #lines do local word = string.match(lines[i], "[^\t]+\t[^\t]+\t([^\t]+)") local local_time, total_time = string.match(lines[i], "[^\t]+\t[^\t]+\t[^\t]+\t[^\t]+\t[^\t]+\t([^\t]+)\t([^\t]+)") local_time = string.gsub(local_time, ",", ".") @@ -138,4 +138,4 @@ for k, v in pairs(sorted) do print(v["info"]["func"] .. "\t" .. v["info"]["total"]) end end -end \ No newline at end of file +end diff --git a/src/core_profiler.h b/src/core_profiler.h index 447ec88..39bb4c6 100755 --- a/src/core_profiler.h +++ b/src/core_profiler.h @@ -29,3 +29,4 @@ int lprofP_callhookOUT(lprofP_STATE* S); /* returns true if the file could be opened */ lprofP_STATE* lprofP_init_core_profiler(const char *_out_filename, int isto_printheader, float _function_call_time); +void lprofP_close_core_profiler(lprofP_STATE* S); diff --git a/src/lua50_profiler.c b/src/lua50_profiler.c index 4e64db1..ad8e7ce 100755 --- a/src/lua50_profiler.c +++ b/src/lua50_profiler.c @@ -214,7 +214,7 @@ static float calcCallTime(lua_State *L) { return lprofC_get_seconds(timer) / (float) 100000; } -static const luaL_reg prof_funcs[] = { +static const luaL_Reg prof_funcs[] = { { "pause", profiler_pause }, { "resume", profiler_resume }, { "start", profiler_init }, @@ -223,7 +223,7 @@ static const luaL_reg prof_funcs[] = { }; int luaopen_profiler(lua_State *L) { - luaL_openlib(L, "profiler", prof_funcs, 0); + luaL_newlib(L, prof_funcs); lua_pushliteral (L, "_COPYRIGHT"); lua_pushliteral (L, "Copyright (C) 2003-2007 Kepler Project"); lua_settable (L, -3);