Permalink
Browse files

Import to git

  • Loading branch information...
0 parents commit 98100d697aed13a6d8ce2794f7e6aa3f45ffa8b2 @drahosp drahosp committed Oct 1, 2010
@@ -0,0 +1,22 @@
+# Copyright (C) 2007-2009 LuaDist.
+# Created by Peter Kapec
+# Redistribution and use of this file is allowed according to the terms of the MIT license.
+# For details see the COPYRIGHT file distributed with LuaDist.
+# Please note that the package source code is licensed under its own license.
+
+PROJECT(luaprofiler C)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+INCLUDE(dist.cmake)
+
+# LuaProfiler modules
+SET (LUAPROFILER_SRC src/clocks.c src/core_profiler.c src/function_meter.c src/stack.c src/lua50_profiler.c)
+
+ADD_LUA_MODULE(profiler ${LUAPROFILER_SRC} src/profiler.def)
+
+# Install LuaProfiler and analyzer
+INSTALL (TARGETS profiler DESTINATION ${INSTALL_CMOD})
+INSTALL (FILES src/analyzer/summary.lua DESTINATION ${INSTALL_BIN})
+
+# Install documentation
+INSTALL(FILES README DESTINATION ${INSTALL_DATA})
+INSTALL(DIRECTORY doc DESTINATION ${INSTALL_DOC})
@@ -0,0 +1,13 @@
+include config.darwin
+
+OBJS= src/clocks.o src/core_profiler.o src/function_meter.o src/stack.o src/lua50_profiler.o
+
+profiler: $(OBJS)
+ export MACOSX_DEPLOYMENT_TARGET=10.3 && mkdir -p bin && gcc -bundle -undefined dynamic_lookup -o $(PROFILER_OUTPUT) $(OBJS)
+
+clean:
+ rm -f $(PROFILER_OUTPUT) src/*.o
+
+install:
+ install -m 0755 $(PROFILER_OUTPUT) /usr/local/lib/lua/5.1
+
@@ -0,0 +1,14 @@
+include config.linux
+
+OBJS= src/clocks.o src/core_profiler.o src/function_meter.o src/stack.o src/lua50_profiler.o
+
+
+profiler: $(OBJS)
+ mkdir -p bin && $(LD) -Bshareable -o $(PROFILER_OUTPUT) $(OBJS)
+
+clean:
+ rm -f $(PROFILER_OUTPUT) src/*.o
+
+install:
+ install -m 0755 $(PROFILER_OUTPUT) /usr/local/lib/lua/5.1
+
@@ -0,0 +1,23 @@
+# $Id: Makefile.win,v 1.8 2007/08/22 17:45:56 carregal Exp $
+
+T= profiler
+V= 2.0.1
+
+include config.win
+
+OBJS= src\clocks.obj src\core_profiler.obj src\function_meter.obj src\stack.obj src\lua50_profiler.obj
+
+lib: src\$(LIBNAME)
+
+.c.obj:
+ $(CC) /c /Fo$@ $(CFLAGS) $<
+
+src\$(LIBNAME): $(OBJS)
+ link /dll /def:src\$T.def /out:src\$(LIBNAME) $(OBJS) $(LUA_LIB)
+
+install: src\$(LIBNAME)
+ IF NOT EXIST $(LUA_LIBDIR) mkdir $(LUA_LIBDIR)
+ copy src\$(LIBNAME) $(LUA_LIBDIR)
+
+clean:
+ del src\$(LIBNAME) $(OBJS) src\$T.lib src\$T.exp
24 README
@@ -0,0 +1,24 @@
+LuaProfiler
+http://www.keplerproject.org/luaprofiler
+
+LuaProfiler is a time profiler designed to help finding bottlenecks on your Lua program.
+
+If you use LuaProfiler into your program, it will generate a log of all your function calls
+and their respective running times. You can use this log to generate a summary of the
+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.
+
+Current version is 2.0.2. It was developed for Lua 5.1.
+
+LuaProfiler can be downloaded from the LuaForge page, or from LuaRocks ("luarocks install
+luaprofiler").
+
+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.
+
+Windows users can use the pre-compiled version of LuaProfiler (profiler.dll) available at LuaForge.
@@ -0,0 +1,10 @@
+
+LUA_INCLUDE= /usr/local/include/lua51
+
+PROFILER_OUTPUT= bin/profiler.so
+
+INCS= -I$(LUA_INCLUDE)
+CC= gcc
+WARN= -ansi -W -Wall
+EXTRA_LIBS=
+CFLAGS= -O2 -DTESTS $(WARN) $(INCS) -I./src
@@ -0,0 +1,10 @@
+
+LUA_INCLUDE= /usr/local/include/lua51
+
+PROFILER_OUTPUT= bin/profiler.so
+
+INCS= -I$(LUA_INCLUDE)
+CC= gcc
+WARN= -ansi -W -Wall
+EXTRA_LIBS=
+CFLAGS= -O2 -DTESTS $(WARN) $(INCS) -I./src
@@ -0,0 +1,17 @@
+# Installation directories
+# System's libraries directory (where binary libraries are installed)
+LUA_LIBDIR= c:\lua5.1
+# Lua includes directory
+LUA_INC= c:\lua5.1\include
+# Lua library
+LUA_LIB= c:\lua5.1\lua5.1.lib
+
+LIBNAME= $T.dll
+
+# Compilation directives
+WARN= /O2
+INCS= /I$(LUA_INC)
+CFLAGS= $(WARN) $(INCS)
+CC= cl
+
+# $Id: config.win,v 1.8 2007/08/22 17:45:56 carregal Exp $
@@ -0,0 +1,130 @@
+# LuaDist CMake utility library.
+# Provides variables and utility functions common to LuaDist CMake builds.
+#
+# Copyright (C) 2007-2010 LuaDist.
+# by David Manura, Peter Drahos
+# Redistribution and use of this file is allowed according to the terms of the MIT license.
+# For details see the COPYRIGHT file distributed with LuaDist.
+# Please note that the package source code is licensed under its own license.
+
+# Few convinence settings
+SET (CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
+SET (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH})
+
+# Where to install module parts:
+set(INSTALL_BIN bin CACHE PATH "Where to install binaries to.")
+set(INSTALL_LIB lib CACHE PATH "Where to install libraries to.")
+set(INSTALL_INC include CACHE PATH "Where to install headers to.")
+set(INSTALL_ETC etc CACHE PATH "Where to store configuration files")
+set(INSTALL_LMOD share/lua/lmod CACHE PATH "Directory to install Lua modules.")
+set(INSTALL_CMOD share/lua/cmod CACHE PATH "Directory to install Lua binary modules.")
+set(INSTALL_DATA share/${PROJECT_NAME} CACHE PATH "Directory the package can store documentation, tests or other data in.")
+set(INSTALL_DOC ${INSTALL_DATA}/doc CACHE PATH "Recommended directory to install documentation into.")
+set(INSTALL_EXAMPLE ${INSTALL_DATA}/example CACHE PATH "Recommended directory to install examples into.")
+set(INSTALL_TEST ${INSTALL_DATA}/test CACHE PATH "Recommended directory to install tests into.")
+set(INSTALL_FOO ${INSTALL_DATA}/etc CACHE PATH "Where to install additional files")
+
+
+# In MSVC, prevent warnings that can occur when using standard libraries.
+if(MSVC)
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+endif(MSVC)
+
+# Adds Lua shared library module target `_target`.
+# Additional sources to build the module are listed after `_target`.
+macro(add_lua_module _target)
+ find_package(Lua51 REQUIRED)
+ include_directories(${LUA_INCLUDE_DIR}) #2DO: somehow apply only to _target?
+
+ add_library(${_target} MODULE ${ARGN})
+ set_target_properties(${_target} PROPERTIES PREFIX "")
+ target_link_libraries(${_target} ${LUA_LIBRARY})
+
+ IF(WIN32)
+ set_target_properties(${_target} PROPERTIES LINK_FLAGS "-Wl,--enable-auto-import")
+ ENDIF()
+
+endmacro(add_lua_module)
+
+# Runs Lua script `_testfile` under CTest tester.
+# Optional argument `_testcurrentdir` is current working directory to run test under
+# (defaults to ${CMAKE_CURRENT_BINARY_DIR}).
+# Both paths, if relative, are relative to ${CMAKE_CURRENT_SOURCE_DIR}.
+# Under LuaDist, set test=true in config.lua to enable testing.
+macro(add_lua_test _testfile)
+ include(CTest)
+ if(BUILD_TESTING)
+ find_program(LUA NAMES lua lua.bat)
+ get_filename_component(TESTFILEABS ${_testfile} ABSOLUTE)
+ get_filename_component(TESTFILENAME ${_testfile} NAME)
+ get_filename_component(TESTFILEBASE ${_testfile} NAME_WE)
+
+ # Write wrapper script.
+ set(TESTWRAPPER ${CMAKE_CURRENT_BINARY_DIR}/${TESTFILENAME})
+ set(TESTWRAPPERSOURCE
+"package.path = '${CMAKE_CURRENT_BINARY_DIR}/?.lua\;${CMAKE_CURRENT_SOURCE_DIR}/?.lua\;' .. package.path
+package.cpath = '${CMAKE_CURRENT_BINARY_DIR}/?.so\;${CMAKE_CURRENT_BINARY_DIR}/?.dll\;' .. package.cpath
+return dofile '${TESTFILEABS}'
+" )
+ if(${ARGC} GREATER 1)
+ set(_testcurrentdir ${ARGV1})
+ get_filename_component(TESTCURRENTDIRABS ${_testcurrentdir} ABSOLUTE)
+ set(TESTWRAPPERSOURCE
+"require 'lfs'
+lfs.chdir('${TESTCURRENTDIRABS}')
+${TESTWRAPPERSOURCE}")
+ endif()
+ FILE(WRITE ${TESTWRAPPER} ${TESTWRAPPERSOURCE})
+
+ add_test(${TESTFILEBASE} ${LUA} ${TESTWRAPPER})
+ endif(BUILD_TESTING)
+
+ # see also http://gdcm.svn.sourceforge.net/viewvc/gdcm/Sandbox/CMakeModules/UsePythonTest.cmake
+endmacro(add_lua_test)
+
+# Converts Lua source file `_source` to binary string embedded in C source
+# file `_target`. Optionally compiles Lua source to byte code (not available
+# under LuaJIT2, which doesn't have a bytecode loader). Additionally, Lua
+# versions of bin2c [1] and luac [2] may be passed respectively as additional
+# arguments.
+#
+# [1] http://lua-users.org/wiki/BinToCee
+# [2] http://lua-users.org/wiki/LuaCompilerInLua
+function(add_lua_bin2c _target _source)
+ find_program(LUA NAMES lua lua.bat)
+ execute_process(COMMAND ${LUA} -e "string.dump(function()end)" RESULT_VARIABLE _LUA_DUMP_RESULT ERROR_QUIET)
+ if (NOT ${_LUA_DUMP_RESULT})
+ SET(HAVE_LUA_DUMP true)
+ endif()
+ message("-- string.dump=${HAVE_LUA_DUMP}")
+
+ if (ARGV2)
+ get_filename_component(BIN2C ${ARGV2} ABSOLUTE)
+ set(BIN2C ${LUA} ${BIN2C})
+ else()
+ find_program(BIN2C NAMES bin2c bin2c.bat)
+ endif()
+ if (HAVE_LUA_DUMP)
+ if (ARGV3)
+ get_filename_component(LUAC ${ARGV3} ABSOLUTE)
+ set(LUAC ${LUA} ${LUAC})
+ else()
+ find_program(LUAC NAMES luac luac.bat)
+ endif()
+ endif (HAVE_LUA_DUMP)
+ message("-- bin2c=${BIN2C}")
+ message("-- luac=${LUAC}")
+
+ get_filename_component(SOURCEABS ${_source} ABSOLUTE)
+ if (HAVE_LUA_DUMP)
+ get_filename_component(SOURCEBASE ${_source} NAME_WE)
+ add_custom_command(
+ OUTPUT ${_target} DEPENDS ${_source}
+ COMMAND ${LUAC} -o ${CMAKE_CURRENT_BINARY_DIR}/${SOURCEBASE}.lo ${SOURCEABS}
+ COMMAND ${BIN2C} ${CMAKE_CURRENT_BINARY_DIR}/${SOURCEBASE}.lo ">${_target}" )
+ else()
+ add_custom_command(
+ OUTPUT ${_target} DEPENDS ${SOURCEABS}
+ COMMAND ${BIN2C} ${_source} ">${_target}" )
+ endif()
+endfunction(add_lua_bin2c)
@@ -0,0 +1,14 @@
+--- This file is part of LuaDist project
+
+name = "luaprofiler"
+version = "2.0.2"
+
+desc = "LuaProfiler is a time profiler designed to help finding bottlenecks on your Lua program."
+author = "Fábio Mascarenhas, André Carregal, Tomás Guisasola, Danilo Tuler"
+license = "MIT/X11"
+url = "http://www.keplerproject.org/luaprofiler/"
+maintainer = "Peter Kapec"
+
+depends = {
+ "lua ~> 5.1"
+}
Oops, something went wrong.

0 comments on commit 98100d6

Please sign in to comment.