From 2450abdf9039621f93cd1bdf5c1dbea96659b633 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 30 May 2013 17:12:37 +0000 Subject: [PATCH] log: optimize log/panic with attribute cold Both logging and calls to panic are never in the critical path. Use the GCC attribute cold to mark these functions as cold, which generates more optimised code. Signed-off-by: Stephen Hemminger Reviewed-by: Vincent Jardin --- lib/librte_eal/common/include/rte_debug.h | 1 + lib/librte_eal/common/include/rte_log.h | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/librte_eal/common/include/rte_debug.h b/lib/librte_eal/common/include/rte_debug.h index e191a2123f..acb4a9f4f5 100644 --- a/lib/librte_eal/common/include/rte_debug.h +++ b/lib/librte_eal/common/include/rte_debug.h @@ -86,6 +86,7 @@ void rte_dump_registers(void); * documentation. */ void __rte_panic(const char *funcname , const char *format, ...) + __attribute__((cold)) __attribute__((noreturn)) __attribute__((format(printf, 2, 3))); diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h index 3dbe010415..5f568c8177 100644 --- a/lib/librte_eal/common/include/rte_log.h +++ b/lib/librte_eal/common/include/rte_log.h @@ -217,6 +217,7 @@ int rte_log_add_in_history(const char *buf, size_t size); * - Negative on error. */ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...) + __attribute__((cold)) __attribute__((format(printf, 3, 4))); /** -- 2.20.1