Lines Matching refs:fmp
1323 static void fmeter_init(struct fmeter *fmp) in fmeter_init() argument
1325 fmp->cnt = 0; in fmeter_init()
1326 fmp->val = 0; in fmeter_init()
1327 fmp->time = 0; in fmeter_init()
1328 spin_lock_init(&fmp->lock); in fmeter_init()
1332 static void fmeter_update(struct fmeter *fmp) in fmeter_update() argument
1335 time_t ticks = now - fmp->time; in fmeter_update()
1342 fmp->val = (FM_COEF * fmp->val) / FM_SCALE; in fmeter_update()
1343 fmp->time = now; in fmeter_update()
1345 fmp->val += ((FM_SCALE - FM_COEF) * fmp->cnt) / FM_SCALE; in fmeter_update()
1346 fmp->cnt = 0; in fmeter_update()
1350 static void fmeter_markevent(struct fmeter *fmp) in fmeter_markevent() argument
1352 spin_lock(&fmp->lock); in fmeter_markevent()
1353 fmeter_update(fmp); in fmeter_markevent()
1354 fmp->cnt = min(FM_MAXCNT, fmp->cnt + FM_SCALE); in fmeter_markevent()
1355 spin_unlock(&fmp->lock); in fmeter_markevent()
1359 static int fmeter_getrate(struct fmeter *fmp) in fmeter_getrate() argument
1363 spin_lock(&fmp->lock); in fmeter_getrate()
1364 fmeter_update(fmp); in fmeter_getrate()
1365 val = fmp->val; in fmeter_getrate()
1366 spin_unlock(&fmp->lock); in fmeter_getrate()