File: autoconf-local-clock.c

package info (click to toggle)
systemtap 5.1-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 47,964 kB
  • sloc: cpp: 80,838; ansic: 54,757; xml: 49,725; exp: 43,665; sh: 11,527; python: 5,003; perl: 2,252; tcl: 1,312; makefile: 1,006; javascript: 149; lisp: 105; awk: 101; asm: 91; java: 70; sed: 16
file content (36 lines) | stat: -rw-r--r-- 1,299 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <linux/sched.h>

// On 4.13 kernels, linux/sched.h doesn't include
// linux/sched/clock.h, where local_clock() is declared.
#include <linux/blkdev.h>

//
// The following kernel commit inlined the local_clock()
//
// commit 2c923e94cd9c6acff3b22f0ae29cfe65e2658b40
// Author: Daniel Lezcano <daniel.lezcano@linaro.org>
// Date:   Mon Apr 11 16:38:34 2016 +0200
//
//     sched/clock: Make local_clock()/cpu_clock() inline
//
//     The local_clock/cpu_clock functions were changed to prevent a double
//     identical test with sched_clock_cpu() when HAVE_UNSTABLE_SCHED_CLOCK
//     is set. That resulted in one line functions.
//
//     As these functions are in all the cases one line functions and in the
//     hot path, it is useful to specify them as static inline in order to
//     give a strong hint to the compiler.
//
//     After verification, it appears the compiler does not inline them
//     without this hint. Change those functions to static inline.
//
//     sched_clock_cpu() is called via the inlined local_clock()/cpu_clock()
//     functions from sched.h. So any module code including sched.h will
//     reference sched_clock_cpu(). Thus it must be exported with the
//     EXPORT_SYMBOL_GPL macro.
//
void foo (void);

void foo (void) {
   (void) local_clock();
}