Lines Matching refs:fmp
2477 static void fmeter_init(struct fmeter *fmp) in fmeter_init() argument
2479 fmp->cnt = 0; in fmeter_init()
2480 fmp->val = 0; in fmeter_init()
2481 fmp->time = 0; in fmeter_init()
2482 spin_lock_init(&fmp->lock); in fmeter_init()
2486 static void fmeter_update(struct fmeter *fmp) in fmeter_update() argument
2492 ticks = now - fmp->time; in fmeter_update()
2499 fmp->val = (FM_COEF * fmp->val) / FM_SCALE; in fmeter_update()
2500 fmp->time = now; in fmeter_update()
2502 fmp->val += ((FM_SCALE - FM_COEF) * fmp->cnt) / FM_SCALE; in fmeter_update()
2503 fmp->cnt = 0; in fmeter_update()
2507 static void fmeter_markevent(struct fmeter *fmp) in fmeter_markevent() argument
2509 spin_lock(&fmp->lock); in fmeter_markevent()
2510 fmeter_update(fmp); in fmeter_markevent()
2511 fmp->cnt = min(FM_MAXCNT, fmp->cnt + FM_SCALE); in fmeter_markevent()
2512 spin_unlock(&fmp->lock); in fmeter_markevent()
2516 static int fmeter_getrate(struct fmeter *fmp) in fmeter_getrate() argument
2520 spin_lock(&fmp->lock); in fmeter_getrate()
2521 fmeter_update(fmp); in fmeter_getrate()
2522 val = fmp->val; in fmeter_getrate()
2523 spin_unlock(&fmp->lock); in fmeter_getrate()