qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] slirp: Mark debugging calls as unlikely
@ 2018-11-21 22:42 Samuel Thibault
  2018-11-22  7:13 ` Marc-André Lureau
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Thibault @ 2018-11-21 22:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: Samuel Thibault, marcandre.lureau, zhangckid, lizhijian, jasowang,
	jan.kiszka

to get them out of the hot path.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 slirp/debug.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/slirp/debug.h b/slirp/debug.h
index ff920f0b87..ad4e07aa01 100644
--- a/slirp/debug.h
+++ b/slirp/debug.h
@@ -17,7 +17,7 @@
 extern int slirp_debug;
 
 #define DEBUG_CALL(fmt, ...) do {               \
-    if (slirp_debug & DBG_CALL) {               \
+    if (unlikely(slirp_debug & DBG_CALL)) {     \
         fprintf(dfd, fmt, ##__VA_ARGS__);       \
         fprintf(dfd, "...\n");                  \
         fflush(dfd);                            \
@@ -25,7 +25,7 @@ extern int slirp_debug;
 } while (0)
 
 #define DEBUG_ARG(fmt, ...) do {                \
-    if (slirp_debug & DBG_CALL) {               \
+    if (unlikely(slirp_debug & DBG_CALL)) {     \
         fputc(' ', dfd);                        \
         fprintf(dfd, fmt, ##__VA_ARGS__);       \
         fputc('\n', dfd);                       \
@@ -36,14 +36,14 @@ extern int slirp_debug;
 #define DEBUG_ARGS(fmt, ...) DEBUG_ARG(fmt, ##__VA_ARGS__)
 
 #define DEBUG_MISC(fmt, ...) do {               \
-    if (slirp_debug & DBG_MISC) {               \
+    if (unlikely(slirp_debug & DBG_MISC)) {     \
         fprintf(dfd, fmt, ##__VA_ARGS__);       \
         fflush(dfd);                            \
     }                                           \
 } while (0)
 
 #define DEBUG_ERROR(fmt, ...) do {              \
-    if (slirp_debug & DBG_ERROR) {              \
+    if (unlikely(slirp_debug & DBG_ERROR)) {    \
         fprintf(dfd, fmt, ##__VA_ARGS__);       \
         fflush(dfd);                            \
     }                                           \
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] slirp: Mark debugging calls as unlikely
  2018-11-21 22:42 [Qemu-devel] [PATCH] slirp: Mark debugging calls as unlikely Samuel Thibault
@ 2018-11-22  7:13 ` Marc-André Lureau
  2018-11-22  9:13   ` Samuel Thibault
  0 siblings, 1 reply; 3+ messages in thread
From: Marc-André Lureau @ 2018-11-22  7:13 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: QEMU, Li Zhijian, Jan Kiszka, Jason Wang, Zhang Chen

Hi

On Thu, Nov 22, 2018 at 2:54 AM Samuel Thibault
<samuel.thibault@ens-lyon.org> wrote:
>
> to get them out of the hot path.
>
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
>  slirp/debug.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/slirp/debug.h b/slirp/debug.h
> index ff920f0b87..ad4e07aa01 100644
> --- a/slirp/debug.h
> +++ b/slirp/debug.h
> @@ -17,7 +17,7 @@
>  extern int slirp_debug;
>
>  #define DEBUG_CALL(fmt, ...) do {               \
> -    if (slirp_debug & DBG_CALL) {               \
> +    if (unlikely(slirp_debug & DBG_CALL)) {     \
>          fprintf(dfd, fmt, ##__VA_ARGS__);       \
>          fprintf(dfd, "...\n");                  \
>          fflush(dfd);                            \
> @@ -25,7 +25,7 @@ extern int slirp_debug;
>  } while (0)
>
>  #define DEBUG_ARG(fmt, ...) do {                \
> -    if (slirp_debug & DBG_CALL) {               \
> +    if (unlikely(slirp_debug & DBG_CALL)) {     \
>          fputc(' ', dfd);                        \
>          fprintf(dfd, fmt, ##__VA_ARGS__);       \
>          fputc('\n', dfd);                       \
> @@ -36,14 +36,14 @@ extern int slirp_debug;
>  #define DEBUG_ARGS(fmt, ...) DEBUG_ARG(fmt, ##__VA_ARGS__)
>
>  #define DEBUG_MISC(fmt, ...) do {               \
> -    if (slirp_debug & DBG_MISC) {               \
> +    if (unlikely(slirp_debug & DBG_MISC)) {     \
>          fprintf(dfd, fmt, ##__VA_ARGS__);       \
>          fflush(dfd);                            \
>      }                                           \
>  } while (0)
>
>  #define DEBUG_ERROR(fmt, ...) do {              \
> -    if (slirp_debug & DBG_ERROR) {              \
> +    if (unlikely(slirp_debug & DBG_ERROR)) {    \
>          fprintf(dfd, fmt, ##__VA_ARGS__);       \
>          fflush(dfd);                            \
>      }                                           \
> --
> 2.19.1
>
>

With s/unlikely/G_UNLIKELY:
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] slirp: Mark debugging calls as unlikely
  2018-11-22  7:13 ` Marc-André Lureau
@ 2018-11-22  9:13   ` Samuel Thibault
  0 siblings, 0 replies; 3+ messages in thread
From: Samuel Thibault @ 2018-11-22  9:13 UTC (permalink / raw)
  To: Marc-André Lureau
  Cc: QEMU, Li Zhijian, Jan Kiszka, Jason Wang, Zhang Chen

Marc-André Lureau, le jeu. 22 nov. 2018 11:13:51 +0400, a ecrit:
> With s/unlikely/G_UNLIKELY:
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Right, pushed, thanks :)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-22  9:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-21 22:42 [Qemu-devel] [PATCH] slirp: Mark debugging calls as unlikely Samuel Thibault
2018-11-22  7:13 ` Marc-André Lureau
2018-11-22  9:13   ` Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).