Lines Matching refs:fmp
2465 static void fmeter_init(struct fmeter *fmp) in fmeter_init() argument
2467 fmp->cnt = 0; in fmeter_init()
2468 fmp->val = 0; in fmeter_init()
2469 fmp->time = 0; in fmeter_init()
2470 spin_lock_init(&fmp->lock); in fmeter_init()
2474 static void fmeter_update(struct fmeter *fmp) in fmeter_update() argument
2480 ticks = now - fmp->time; in fmeter_update()
2487 fmp->val = (FM_COEF * fmp->val) / FM_SCALE; in fmeter_update()
2488 fmp->time = now; in fmeter_update()
2490 fmp->val += ((FM_SCALE - FM_COEF) * fmp->cnt) / FM_SCALE; in fmeter_update()
2491 fmp->cnt = 0; in fmeter_update()
2495 static void fmeter_markevent(struct fmeter *fmp) in fmeter_markevent() argument
2497 spin_lock(&fmp->lock); in fmeter_markevent()
2498 fmeter_update(fmp); in fmeter_markevent()
2499 fmp->cnt = min(FM_MAXCNT, fmp->cnt + FM_SCALE); in fmeter_markevent()
2500 spin_unlock(&fmp->lock); in fmeter_markevent()
2504 static int fmeter_getrate(struct fmeter *fmp) in fmeter_getrate() argument
2508 spin_lock(&fmp->lock); in fmeter_getrate()
2509 fmeter_update(fmp); in fmeter_getrate()
2510 val = fmp->val; in fmeter_getrate()
2511 spin_unlock(&fmp->lock); in fmeter_getrate()