[FFmpeg-devel] lavu/attributes: add av_never_inline macro

Submitted by Rostislav Pehlivanov on April 12, 2017, 8:10 p.m.

Details

Message ID 20170412201022.24596-1-atomnuker@gmail.com
State New
Headers show

Commit Message

Rostislav Pehlivanov April 12, 2017, 8:10 p.m.
Very useful for determining hot functions without recompiling everything
with inlining disabled.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
---
 libavutil/attributes.h | 10 ++++++++++
 libavutil/version.h    |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

Comments

Muhammad Faiz April 12, 2017, 8:39 p.m.
On Thu, Apr 13, 2017 at 3:10 AM, Rostislav Pehlivanov
<atomnuker@gmail.com> wrote:
> Very useful for determining hot functions without recompiling everything
> with inlining disabled.
>
> Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
> ---
>  libavutil/attributes.h | 10 ++++++++++
>  libavutil/version.h    |  2 +-
>  2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/libavutil/attributes.h b/libavutil/attributes.h
> index 54d1901116..d62f54a834 100644
> --- a/libavutil/attributes.h
> +++ b/libavutil/attributes.h
> @@ -44,6 +44,16 @@
>  #endif
>  #endif
>
> +#ifndef av_never_inline
> +#if AV_GCC_VERSION_AT_LEAST(3,1)
> +#    define av_never_inline __attribute__((noinline))
> +#elif defined(_MSC_VER)
> +#    define av_never_inline __declspec(noinline)
> +#else
> +#    define av_never_inline
> +#endif
> +#endif

av_noinline has been already here.

thanks.
James Almer April 12, 2017, 8:41 p.m.
On 4/12/2017 5:10 PM, Rostislav Pehlivanov wrote:
> Very useful for determining hot functions without recompiling everything
> with inlining disabled.

If it's only useful for developers, then it shouldn't be a public
attribute.

Add it to internal.h, like with attribute_align_arg and av_export.

> 
> Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
> ---
>  libavutil/attributes.h | 10 ++++++++++
>  libavutil/version.h    |  2 +-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/libavutil/attributes.h b/libavutil/attributes.h
> index 54d1901116..d62f54a834 100644
> --- a/libavutil/attributes.h
> +++ b/libavutil/attributes.h
> @@ -44,6 +44,16 @@
>  #endif
>  #endif
>  
> +#ifndef av_never_inline
> +#if AV_GCC_VERSION_AT_LEAST(3,1)
> +#    define av_never_inline __attribute__((noinline))
> +#elif defined(_MSC_VER)
> +#    define av_never_inline __declspec(noinline)
> +#else
> +#    define av_never_inline
> +#endif
> +#endif
> +
>  #ifndef av_extern_inline
>  #if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
>  #    define av_extern_inline extern inline
> diff --git a/libavutil/version.h b/libavutil/version.h
> index bba39e0180..90d9137e08 100644
> --- a/libavutil/version.h
> +++ b/libavutil/version.h
> @@ -79,7 +79,7 @@
>   */
>  
>  #define LIBAVUTIL_VERSION_MAJOR  55
> -#define LIBAVUTIL_VERSION_MINOR  61
> +#define LIBAVUTIL_VERSION_MINOR  62
>  #define LIBAVUTIL_VERSION_MICRO 100
>  
>  #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
>

Patch hide | download patch | download mbox

diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index 54d1901116..d62f54a834 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -44,6 +44,16 @@ 
 #endif
 #endif
 
+#ifndef av_never_inline
+#if AV_GCC_VERSION_AT_LEAST(3,1)
+#    define av_never_inline __attribute__((noinline))
+#elif defined(_MSC_VER)
+#    define av_never_inline __declspec(noinline)
+#else
+#    define av_never_inline
+#endif
+#endif
+
 #ifndef av_extern_inline
 #if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
 #    define av_extern_inline extern inline
diff --git a/libavutil/version.h b/libavutil/version.h
index bba39e0180..90d9137e08 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@ 
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  55
-#define LIBAVUTIL_VERSION_MINOR  61
+#define LIBAVUTIL_VERSION_MINOR  62
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \