diff options
author | Russell Belfer <rb@github.com> | 2014-04-29 15:05:58 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-05-02 09:21:33 -0700 |
commit | 9c8ed4999740e921ecc2966bbcd0dbcfc725f59a (patch) | |
tree | cf801e2026c9fca6b4e28bfc2c35e981d9ccea6e /include/git2 | |
parent | 7a2e56a3f6115c3a145e4f73d0aa8bea6dded899 (diff) | |
download | libgit2-9c8ed4999740e921ecc2966bbcd0dbcfc725f59a.tar.gz |
Remove trace / add git_diff_perfdata struct + api
Diffstat (limited to 'include/git2')
-rw-r--r-- | include/git2/diff.h | 30 | ||||
-rw-r--r-- | include/git2/status.h | 9 | ||||
-rw-r--r-- | include/git2/sys/diff.h | 28 | ||||
-rw-r--r-- | include/git2/trace.h | 43 |
4 files changed, 59 insertions, 51 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h index 18880889c..b849e3bb5 100644 --- a/include/git2/diff.h +++ b/include/git2/diff.h @@ -391,14 +391,13 @@ typedef struct { * Initializes a `git_diff_options` with default values. Equivalent to * creating an instance with GIT_DIFF_OPTIONS_INIT. * -* @param opts the `git_diff_options` instance to initialize. -* @param version the version of the struct; you should pass -* `GIT_DIFF_OPTIONS_VERSION` here. +* @param opts The `git_diff_options` instance to initialize. +* @param version Version of struct; pass `GIT_DIFF_OPTIONS_VERSION` * @return Zero on success; -1 on failure. */ GIT_EXTERN(int) git_diff_init_options( - git_diff_options* opts, - int version); + git_diff_options *opts, + unsigned int version); /** * When iterating over a diff, callback that will be made per file. @@ -632,14 +631,13 @@ typedef struct { * Initializes a `git_diff_find_options` with default values. Equivalent to * creating an instance with GIT_DIFF_FIND_OPTIONS_INIT. * -* @param opts the `git_diff_find_options` instance to initialize. -* @param version the version of the struct; you should pass -* `GIT_DIFF_FIND_OPTIONS_VERSION` here. +* @param opts The `git_diff_find_options` instance to initialize. +* @param version Version of struct; pass `GIT_DIFF_FIND_OPTIONS_VERSION` * @return Zero on success; -1 on failure. */ GIT_EXTERN(int) git_diff_find_init_options( - git_diff_find_options* opts, - int version); + git_diff_find_options *opts, + unsigned int version); /** @name Diff Generator Functions * @@ -1223,17 +1221,17 @@ GIT_EXTERN(int) git_diff_commit_as_email( const git_diff_options *diff_opts); /** -* Initializes a `git_diff_format_email_options` with default values. Equivalent to -* creating an instance with GIT_DIFF_FORMAT_EMAIL_OPTIONS_INIT. +* Initializes a `git_diff_format_email_options` with default values. * -* @param opts the `git_diff_format_email_options` instance to initialize. -* @param version the version of the struct; you should pass -* `GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION` here. +* Equivalent to creating an instance with GIT_DIFF_FORMAT_EMAIL_OPTIONS_INIT. +* +* @param opts Uhe `git_diff_format_email_options` instance to initialize. +* @param version Version of struct; pass `GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION` * @return Zero on success; -1 on failure. */ GIT_EXTERN(int) git_diff_format_email_init_options( git_diff_format_email_options *opts, - int version); + unsigned int version); GIT_END_DECL diff --git a/include/git2/status.h b/include/git2/status.h index ee2f33287..effe5e1ea 100644 --- a/include/git2/status.h +++ b/include/git2/status.h @@ -184,14 +184,13 @@ typedef struct { * Initializes a `git_status_options` with default values. Equivalent to * creating an instance with GIT_STATUS_OPTIONS_INIT. * - * @param opts the `git_status_options` instance to initialize. - * @param version the version of the struct; you should pass - * `GIT_STATUS_OPTIONS_VERSION` here. + * @param opts The `git_status_options` instance to initialize. + * @param version Version of struct; pass `GIT_STATUS_OPTIONS_VERSION` * @return Zero on success; -1 on failure. */ GIT_EXTERN(int) git_status_init_options( - git_status_options* opts, - int version); + git_status_options *opts, + unsigned int version); /** * A status entry, providing the differences between the file as it exists diff --git a/include/git2/sys/diff.h b/include/git2/sys/diff.h index bc6cdf393..48d72f4f9 100644 --- a/include/git2/sys/diff.h +++ b/include/git2/sys/diff.h @@ -10,6 +10,8 @@ #include "git2/common.h" #include "git2/types.h" #include "git2/oid.h" +#include "git2/diff.h" +#include "git2/status.h" /** * @file git2/sys/diff.h @@ -58,6 +60,32 @@ GIT_EXTERN(int) git_diff_print_callback__to_file_handle( const git_diff_line *line, void *payload); /*< payload must be a `FILE *` */ + +typedef struct { + unsigned int version; + size_t stat_calls; + size_t oid_calculations; +} git_diff_perfdata; + +#define GIT_DIFF_PERFDATA_VERSION 1 +#define GIT_DIFF_PERFDATA_INIT {GIT_DIFF_PERFDATA_VERSION,0,0} + +/** + * Get performance data for a diff object. + * + * @param out Structure to be filled with diff performance data + * @param diff Diff to read performance data from + * @return 0 for success, <0 for error + */ +GIT_EXTERN(int) git_diff_get_perfdata( + git_diff_perfdata *out, const git_diff *diff); + +/** + * Get performance data for diffs from a git_status_list + */ +GIT_EXTERN(int) git_status_list_get_perfdata( + git_diff_perfdata *out, const git_status_list *status); + /** @} */ GIT_END_DECL #endif diff --git a/include/git2/trace.h b/include/git2/trace.h index 867b34612..f9b4d6ff6 100644 --- a/include/git2/trace.h +++ b/include/git2/trace.h @@ -20,64 +20,47 @@ GIT_BEGIN_DECL /** - * Available tracing messages. Each tracing level can be enabled - * independently or pass GIT_TRACE_ALL to enable all levels. + * Available tracing levels. When tracing is set to a particular level, + * callers will be provided tracing at the given level and all lower levels. */ typedef enum { /** No tracing will be performed. */ - GIT_TRACE_NONE = 0x0000u, - - /** All tracing messages will be sent. */ - GIT_TRACE_ALL = 0xFFFFu, + GIT_TRACE_NONE = 0, /** Severe errors that may impact the program's execution */ - GIT_TRACE_FATAL = 0x0001u, + GIT_TRACE_FATAL = 1, /** Errors that do not impact the program's execution */ - GIT_TRACE_ERROR = 0x0002u, - GIT_TRACE_ERROR_AND_BELOW = 0x0003u, + GIT_TRACE_ERROR = 2, /** Warnings that suggest abnormal data */ - GIT_TRACE_WARN = 0x0004u, - GIT_TRACE_WARN_AND_BELOW = 0x0007u, + GIT_TRACE_WARN = 3, /** Informational messages about program execution */ - GIT_TRACE_INFO = 0x0008u, - GIT_TRACE_INFO_AND_BELOW = 0x000Fu, + GIT_TRACE_INFO = 4, /** Detailed data that allows for debugging */ - GIT_TRACE_DEBUG = 0x0010u, + GIT_TRACE_DEBUG = 5, /** Exceptionally detailed debugging data */ - GIT_TRACE_TRACE = 0x0020u, - - /** Performance tracking related traces */ - GIT_TRACE_PERF = 0x0040u, + GIT_TRACE_TRACE = 6 } git_trace_level_t; /** * An instance for a tracing function */ -typedef void (*git_trace_callback)( - git_trace_level_t level, /* just one bit will be sent */ - void *cb_payload, - void *msg_payload, - const char *msg); +typedef void (*git_trace_callback)(git_trace_level_t level, const char *msg); /** * Sets the system tracing configuration to the specified level with the * specified callback. When system events occur at a level equal to, or * lower than, the given level they will be reported to the given callback. * - * @param level Bitmask of all enabled trace levels - * @param cb Function to call with trace messages - * @param cb_payload Payload to pass when callback is invoked + * @param level Level to set tracing to + * @param cb Function to call with trace data * @return 0 or an error code */ -GIT_EXTERN(int) git_trace_set( - git_trace_level_t level, - git_trace_callback cb, - void *cb_payload); +GIT_EXTERN(int) git_trace_set(git_trace_level_t level, git_trace_callback cb); /** @} */ GIT_END_DECL |