summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-05-17 13:05:17 -0700
committerRussell Belfer <rb@github.com>2012-05-17 13:05:17 -0700
commit706a9974a297ea1b38c6aab886b54598409725e8 (patch)
tree206597edf7b85241b6b00039eae76b67e2274dfe
parentdb756d5898fa6e0bdd2aeaa2cccfa55ece6c09a2 (diff)
downloadlibgit2-706a9974a297ea1b38c6aab886b54598409725e8.tar.gz
Basic setup for profiling
This fixes the examples so they will build and adds a PROFILE option to the CMakeFile that enabled gprof info on non-Windows
-rw-r--r--CMakeLists.txt5
-rw-r--r--examples/diff.c8
-rw-r--r--examples/general.c2
3 files changed, 13 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d30d09df9..bfbabc0a5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,6 +53,7 @@ OPTION (BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON)
OPTION (THREADSAFE "Build libgit2 as threadsafe" OFF)
OPTION (BUILD_CLAR "Build Tests using the Clar suite" ON)
OPTION (TAGS "Generate tags" OFF)
+OPTION (PROFILE "Generate profiling information" OFF)
# Platform specific compilation flags
IF (MSVC)
@@ -74,6 +75,10 @@ ELSE ()
IF (NOT MINGW) # MinGW always does PIC and complains if we tell it to
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
ENDIF ()
+ IF (PROFILE)
+ SET(CMAKE_C_FLAGS "-pg ${CMAKE_C_FLAGS}")
+ SET(CMAKE_EXE_LINKER_FLAGS "-pg ${CMAKE_EXE_LINKER_FLAGS}")
+ ENDIF ()
ENDIF()
# Build Debug by default
diff --git a/examples/diff.c b/examples/diff.c
index 20e14e511..1b4ab549b 100644
--- a/examples/diff.c
+++ b/examples/diff.c
@@ -61,7 +61,13 @@ char *colors[] = {
"\033[36m" /* cyan */
};
-int printer(void *data, char usage, const char *line)
+int printer(
+ void *data,
+ git_diff_delta *delta,
+ git_diff_range *range,
+ char usage,
+ const char *line,
+ size_t line_len)
{
int *last_color = data, color = 0;
diff --git a/examples/general.c b/examples/general.c
index 0a908bc48..46f2009bc 100644
--- a/examples/general.c
+++ b/examples/general.c
@@ -273,7 +273,7 @@ int main (int argc, char** argv)
// Once you have the entry object, you can access the content or subtree (or commit, in the case
// of submodules) that it points to. You can also get the mode if you want.
- git_tree_entry_2object(&objt, repo, entry); // blob
+ git_tree_entry_to_object(&objt, repo, entry); // blob
// Remember to close the looked-up object once you are done using it
git_object_free(objt);