cregit-Linux how code gets into the kernel

Release 4.10 arch/powerpc/include/asm/cputime.h

/*
 * Definitions for measuring cputime on powerpc machines.
 *
 * Copyright (C) 2006 Paul Mackerras, IBM Corp.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 *
 * If we have CONFIG_VIRT_CPU_ACCOUNTING_NATIVE, we measure cpu time in
 * the same units as the timebase.  Otherwise we measure cpu time
 * in jiffies using the generic definitions.
 */

#ifndef __POWERPC_CPUTIME_H

#define __POWERPC_CPUTIME_H

#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
#include <asm-generic/cputime.h>
#ifdef __KERNEL__

static inline void setup_cputime_one_jiffy(void) { }

Contributors

PersonTokensPropCommitsCommitProp
stanislaw gruszkastanislaw gruszka8100.00%1100.00%
Total8100.00%1100.00%

#endif #else #include <linux/types.h> #include <linux/time.h> #include <asm/div64.h> #include <asm/time.h> #include <asm/param.h> #include <asm/cpu_has_feature.h> typedef u64 __nocast cputime_t; typedef u64 __nocast cputime64_t; #define cmpxchg_cputime(ptr, old, new) cmpxchg(ptr, old, new) #ifdef __KERNEL__ /* * One jiffy in timebase units computed during initialization */ extern cputime_t cputime_one_jiffy; /* * Convert cputime <-> jiffies */ extern u64 __cputime_jiffies_factor;
static inline unsigned long cputime_to_jiffies(const cputime_t ct) { return mulhdu((__force u64) ct, __cputime_jiffies_factor); }

Contributors

PersonTokensPropCommitsCommitProp
paul mackerraspaul mackerras2083.33%150.00%
martin schwidefskymartin schwidefsky416.67%150.00%
Total24100.00%2100.00%


static inline cputime_t jiffies_to_cputime(const unsigned long jif) { u64 ct; unsigned long sec; /* have to be a little careful about overflow */ ct = jif % HZ; sec = jif / HZ; if (ct) { ct *= tb_ticks_per_sec; do_div(ct, HZ); } if (sec) ct += (cputime_t) sec * tb_ticks_per_sec; return (__force cputime_t) ct; }

Contributors

PersonTokensPropCommitsCommitProp
paul mackerraspaul mackerras6492.75%150.00%
martin schwidefskymartin schwidefsky57.25%150.00%
Total69100.00%2100.00%


static inline void setup_cputime_one_jiffy(void) { cputime_one_jiffy = jiffies_to_cputime(1); }

Contributors

PersonTokensPropCommitsCommitProp
stanislaw gruszkastanislaw gruszka16100.00%1100.00%
Total16100.00%1100.00%


static inline cputime64_t jiffies64_to_cputime64(const u64 jif) { u64 ct; u64 sec = jif; /* have to be a little careful about overflow */ ct = do_div(sec, HZ); if (ct) { ct *= tb_ticks_per_sec; do_div(ct, HZ); } if (sec) ct += (u64) sec * tb_ticks_per_sec; return (__force cputime64_t) ct; }

Contributors

PersonTokensPropCommitsCommitProp
david woodhousedavid woodhouse5481.82%133.33%
martin schwidefskymartin schwidefsky69.09%133.33%
christophe leroychristophe leroy69.09%133.33%
Total66100.00%3100.00%


static inline u64 cputime64_to_jiffies64(const cputime_t ct) { return mulhdu((__force u64) ct, __cputime_jiffies_factor); }

Contributors

PersonTokensPropCommitsCommitProp
paul mackerraspaul mackerras1982.61%150.00%
martin schwidefskymartin schwidefsky417.39%150.00%
Total23100.00%2100.00%

/* * Convert cputime <-> microseconds */ extern u64 __cputime_usec_factor;
static inline unsigned long cputime_to_usecs(const cputime_t ct) { return mulhdu((__force u64) ct, __cputime_usec_factor); }

Contributors

PersonTokensPropCommitsCommitProp
paul mackerraspaul mackerras1875.00%125.00%
martin schwidefskymartin schwidefsky416.67%125.00%
andreas schwabandreas schwab14.17%125.00%
michael holzheumichael holzheu14.17%125.00%
Total24100.00%4100.00%


static inline cputime_t usecs_to_cputime(const unsigned long us) { u64 ct; unsigned long sec; /* have to be a little careful about overflow */ ct = us % 1000000; sec = us / 1000000; if (ct) { ct *= tb_ticks_per_sec; do_div(ct, 1000000); } if (sec) ct += (cputime_t) sec * tb_ticks_per_sec; return (__force cputime_t) ct; }

Contributors

PersonTokensPropCommitsCommitProp
paul mackerraspaul mackerras5782.61%125.00%
michael holzheumichael holzheu68.70%125.00%
martin schwidefskymartin schwidefsky57.25%125.00%
andreas schwabandreas schwab11.45%125.00%
Total69100.00%4100.00%

#define usecs_to_cputime64(us) usecs_to_cputime(us) /* * Convert cputime <-> seconds */ extern u64 __cputime_sec_factor;
static inline unsigned long cputime_to_secs(const cputime_t ct) { return mulhdu((__force u64) ct, __cputime_sec_factor); }

Contributors

PersonTokensPropCommitsCommitProp
paul mackerraspaul mackerras2083.33%150.00%
martin schwidefskymartin schwidefsky416.67%150.00%
Total24100.00%2100.00%


static inline cputime_t secs_to_cputime(const unsigned long sec) { return (__force cputime_t)((u64) sec * tb_ticks_per_sec); }

Contributors

PersonTokensPropCommitsCommitProp
paul mackerraspaul mackerras1973.08%150.00%
martin schwidefskymartin schwidefsky726.92%150.00%
Total26100.00%2100.00%

/* * Convert cputime <-> timespec */
static inline void cputime_to_timespec(const cputime_t ct, struct timespec *p) { u64 x = (__force u64) ct; unsigned int frac; frac = do_div(x, tb_ticks_per_sec); p->tv_sec = x; x = (u64) frac * 1000000000; do_div(x, tb_ticks_per_sec); p->tv_nsec = x; }

Contributors

PersonTokensPropCommitsCommitProp
paul mackerraspaul mackerras6293.94%150.00%
martin schwidefskymartin schwidefsky46.06%150.00%
Total66100.00%2100.00%


static inline cputime_t timespec_to_cputime(const struct timespec *p) { u64 ct; ct = (u64) p->tv_nsec * tb_ticks_per_sec; do_div(ct, 1000000000); return (__force cputime_t)(ct + (u64) p->tv_sec * tb_ticks_per_sec); }

Contributors

PersonTokensPropCommitsCommitProp
paul mackerraspaul mackerras4586.54%150.00%
martin schwidefskymartin schwidefsky713.46%150.00%
Total52100.00%2100.00%

/* * Convert cputime <-> timeval */
static inline void cputime_to_timeval(const cputime_t ct, struct timeval *p) { u64 x = (__force u64) ct; unsigned int frac; frac = do_div(x, tb_ticks_per_sec); p->tv_sec = x; x = (u64) frac * 1000000; do_div(x, tb_ticks_per_sec); p->tv_usec = x; }

Contributors

PersonTokensPropCommitsCommitProp
paul mackerraspaul mackerras6293.94%150.00%
martin schwidefskymartin schwidefsky46.06%150.00%
Total66100.00%2100.00%


static inline cputime_t timeval_to_cputime(const struct timeval *p) { u64 ct; ct = (u64) p->tv_usec * tb_ticks_per_sec; do_div(ct, 1000000); return (__force cputime_t)(ct + (u64) p->tv_sec * tb_ticks_per_sec); }

Contributors

PersonTokensPropCommitsCommitProp
paul mackerraspaul mackerras4586.54%150.00%
martin schwidefskymartin schwidefsky713.46%150.00%
Total52100.00%2100.00%

/* * Convert cputime <-> clock_t (units of 1/USER_HZ seconds) */ extern u64 __cputime_clockt_factor;
static inline unsigned long cputime_to_clock_t(const cputime_t ct) { return mulhdu((__force u64) ct, __cputime_clockt_factor); }

Contributors

PersonTokensPropCommitsCommitProp
paul mackerraspaul mackerras2083.33%150.00%
martin schwidefskymartin schwidefsky416.67%150.00%
Total24100.00%2100.00%


static inline cputime_t clock_t_to_cputime(const unsigned long clk) { u64 ct; unsigned long sec; /* have to be a little careful about overflow */ ct = clk % USER_HZ; sec = clk / USER_HZ; if (ct) { ct *= tb_ticks_per_sec; do_div(ct, USER_HZ); } if (sec) ct += (u64) sec * tb_ticks_per_sec; return (__force cputime_t) ct; }

Contributors

PersonTokensPropCommitsCommitProp
paul mackerraspaul mackerras6391.30%150.00%
martin schwidefskymartin schwidefsky68.70%150.00%
Total69100.00%2100.00%

#define cputime64_to_clock_t(ct) cputime_to_clock_t((cputime_t)(ct)) /* * PPC64 uses PACA which is task independent for storing accounting data while * PPC32 uses struct thread_info, therefore at task switch the accounting data * has to be populated in the new task */ #ifdef CONFIG_PPC64
static inline void arch_vtime_task_switch(struct task_struct *tsk) { }

Contributors

PersonTokensPropCommitsCommitProp
frederic weisbeckerfrederic weisbecker11100.00%1100.00%
Total11100.00%1100.00%

#else void arch_vtime_task_switch(struct task_struct *tsk); #endif #endif /* __KERNEL__ */ #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ #endif /* __POWERPC_CPUTIME_H */

Overall Contributors

PersonTokensPropCommitsCommitProp
paul mackerraspaul mackerras58571.52%17.14%
martin schwidefskymartin schwidefsky738.92%17.14%
david woodhousedavid woodhouse546.60%17.14%
stanislaw gruszkastanislaw gruszka344.16%17.14%
christophe leroychristophe leroy232.81%17.14%
frederic weisbeckerfrederic weisbecker141.71%214.29%
rik van rielrik van riel111.34%17.14%
andreas schwabandreas schwab101.22%214.29%
michael holzheumichael holzheu80.98%17.14%
kevin haokevin hao30.37%17.14%
bartlomiej zolnierkiewiczbartlomiej zolnierkiewicz20.24%17.14%
stephen rothwellstephen rothwell10.12%17.14%
Total818100.00%14100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.