git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] trace: improve performance while category is disabled

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 27, 2017, 01:32 UTC
Message-ID
<xmqqlgisfquy.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqqpo84fre1.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 12 quoted lines
> gennady.kupava@gmail.com writes:
>
>> From: Gennady Kupava <gkupava@bloomberg.net>
>>
>> - Do the check if the trace key is enabled sooner in call chain.
>> - Move just enough code from trace.c into trace.h header so all code
>>   necessary to determine that trace is disabled could be inlined to
>>   calling functions.
>
> Makes sense.  Will queue.
>
> Thanks.

Just in case others notice style and whitespace issues, I've applied the following to fix them, so there is no need to reroll only to fix these.

diff --git a/trace.h b/trace.h
index db10f2afeb..05395242aa 100644
--- a/trace.h
+++ b/trace.h
@@ -85,29 +85,29 @@ extern void trace_performance_since(uint64_t start, const char *format, ...);
 		if (trace_pass_fl(key))					    \
 			trace_printf_key_fl(TRACE_CONTEXT, __LINE__, key,   \
 					    __VA_ARGS__);		    \
-	} while(0)
+	} while (0)
 
 #define trace_printf(...) trace_printf_key(&trace_default_key, __VA_ARGS__)
 
 #define trace_argv_printf(argv, ...)					    \
 	do {								    \
 		if (trace_pass_fl(&trace_default_key))			    \
-		       trace_argv_printf_fl(TRACE_CONTEXT, __LINE__,	    \
+			trace_argv_printf_fl(TRACE_CONTEXT, __LINE__,	    \
 					    argv, __VA_ARGS__);		    \
-	} while(0)
+	} while (0)
 
 #define trace_strbuf(key, data)						    \
 	do {								    \
 		if (trace_pass_fl(key))					    \
 			trace_strbuf_fl(TRACE_CONTEXT, __LINE__, key, data);\
-	} while(0)
+	} while (0)
 
 #define trace_performance(nanos, ...)					    \
 	do {								    \
 		if (trace_pass_fl(&trace_perf_key))			    \
 			trace_performance_fl(TRACE_CONTEXT, __LINE__, nanos,\
-					     __VA_ARGS__);  		    \
-	} while(0)
+					     __VA_ARGS__);		    \
+	} while (0)
 
 #define trace_performance_since(start, ...)				    \
 	do {								    \
@@ -115,7 +115,7 @@ extern void trace_performance_since(uint64_t start, const char *format, ...);
 			trace_performance_fl(TRACE_CONTEXT, __LINE__,       \
 					     getnanotime() - (start),	    \
 					     __VA_ARGS__);		    \
-	} while(0)
+	} while (0)
 
 /* backend functions, use non-*fl macros instead */
 __attribute__((format (printf, 4, 5)))
@@ -129,7 +129,8 @@ extern void trace_strbuf_fl(const char *file, int line, struct trace_key *key,
 __attribute__((format (printf, 4, 5)))
 extern void trace_performance_fl(const char *file, int line,
 				 uint64_t nanos, const char *fmt, ...);
-inline int trace_pass_fl(struct trace_key *key) {
+inline int trace_pass_fl(struct trace_key *key)
+{
 	return key->fd || !key->initialized;
 }
 
Previous: Junio C HamanoNext: Junio C Hamano
Message 18 of 20 in “Reduce performance penalty for turned off traces”
  1. Reduce performance penalty for turned off tracesgennady.kupava@gmail.com, Nov 11, 2017
  2. Jeff KingNov 12, 2017
  3. Gennady KupavaNov 12, 2017
  4. Jeff KingNov 17, 2017
  5. Stefan BellerNov 15, 2017
  6. Jeff KingNov 17, 2017
  7. 1/2 Simplify tracing code by removing trace key normalization conceptgennady.kupava@gmail.com, Nov 19, 2017
  8. 2/2 Reduce performance cost of the trace if trace category is disabledgennady.kupava@gmail.com, Nov 19, 2017
  9. Johannes SixtNov 19, 2017
  10. Gennady KupavaNov 19, 2017
  11. Junio C HamanoNov 19, 2017
  12. Gennady KupavaNov 19, 2017
  13. Junio C HamanoNov 20, 2017
  14. Junio C HamanoNov 20, 2017
  15. 1/2 trace: remove trace key normalizationgennady.kupava@gmail.com, Nov 26, 2017
  16. 2/2 trace: improve performance while category is disabledgennady.kupava@gmail.com, Nov 26, 2017
  17. Junio C HamanoNov 27, 2017
  18. Junio C HamanoNov 27, 2017
  19. Junio C HamanoNov 27, 2017
  20. Gennady KupavaNov 27, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.