login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
October
»
22
Re: [PATCH v3] Add generic exponentially weighted moving average (EWMA) function
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
[view in full thread]
From: KOSAKI Motohiro
Subject:
Re: [PATCH v3] Add generic exponentially weighted moving average (EWMA) function
Date: Thursday, October 21, 2010 - 6:28 pm
> On Fri October 22 2010 10:11:38 KOSAKI Motohiro wrote:
quoted text
> > few additional reviewing comments is here. > > > > > +struct ewma { > > > + unsigned int internal; > > > + unsigned int factor; > > > + unsigned int weight; > > > +}; > > > > I think unsigned long is better because long is natual register size > > on both 32bit and 64bit arch. > > and, example, almost linux resource limit is using long or ulong. then > > uint may have overflow risk if we are using this one on 64bit arch. > > Does uint has any benefit? (note: scheduler loadavg has already used ulong) > > You know more about this than me. I have no specific reason to use unsigned > int. I'll change it to unsigned long, if that's better.
Thank you.
quoted text
> > > +struct ewma* > > > +ewma_add(struct ewma *avg, const unsigned int val) > > > +{ > > > + avg->internal = avg->internal ? > > > + (((avg->internal * (avg->weight - 1)) + > > > + (val * avg->factor)) / avg->weight) : > > > + (val * avg->factor); > > > + return avg; > > > > Hm, if ewma_add has this function prototype, we almost always need to > > typing "new = ewma_get(ewma_add(&ewma, val))". Is this intentional? > > if so, why? > > > > Why can't we simple do following? > > > > unsigned long ewma_add(struct ewma *avg, const unsigned int val) > > { > > (snip) > > return ewma_get(avg); > > } > > Hmm, I guess that depends on the way you want to use it. In my case, most of > the times when I add a value to the average, I don't need to get the value. > I'd call ewma_add() many more times than ewma_get(). Having the functions > defined like this gives us the flexibility to choose and IMHO > ewma_get(ewma_add(&ewma, val)) isn't so bad?
OK. I've got it. I agree we don't change this. Thank you for very quick responce! --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
Messages in current thread:
[PATCH v3] Add generic exponentially weighted moving avera ...
, Bruno Randolf
, (Wed Oct 20, 1:23 am)
Re: [PATCH v3] Add generic exponentially weighted moving a ...
, Peter Zijlstra
, (Wed Oct 20, 8:03 am)
Re: [PATCH v3] Add generic exponentially weighted moving a ...
, Bruno Randolf
, (Wed Oct 20, 10:40 pm)
Re: [PATCH v3] Add generic exponentially weighted moving a ...
, Peter Zijlstra
, (Thu Oct 21, 3:04 am)
Re: [PATCH v3] Add generic exponentially weighted moving a ...
, KOSAKI Motohiro
, (Thu Oct 21, 3:31 am)
Re: [PATCH v3] Add generic exponentially weighted moving a ...
, Bruno Randolf
, (Thu Oct 21, 5:53 pm)
Re: [PATCH v3] Add generic exponentially weighted moving a ...
, KOSAKI Motohiro
, (Thu Oct 21, 6:11 pm)
Re: [PATCH v3] Add generic exponentially weighted moving a ...
, Bruno Randolf
, (Thu Oct 21, 6:25 pm)
Re: [PATCH v3] Add generic exponentially weighted moving a ...
, KOSAKI Motohiro
, (Thu Oct 21, 6:28 pm)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Ray Lee
Re: New thread RDSL, post-2.6.20 kernels and amanda (tar) miss-fires
Alan Cox
Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)
Tejun Heo
Re: your mail
Werner Cornelius
Serial USB-driver for Winchiphead CH340/41 chip
Ingo Molnar
Re: [patch] e1000=y && e1000e=m regression fix
git
:
Bill Lear
cpio command not found
Gary Yang
fatal: did you run git update-server-info on the server? mv post-update.sample pos...
Ben Schmidt
Getting the path right for git over SSH
Fredrik Kuivinen
Re: fatal: unable to create '.git/index': File exists
Laflen, Brandon (GE, Research)
RE: fatal: Unable to find remote helper for 'http'
linux-netdev
:
Stephen Hemminger
Re: vlan JMicron Technologies, Inc. JMC250 PCI Express Gigabit Ethernet
Sage Weil
Re: [2/3] POHMELFS: Documentation.
Patrick McHardy
Re: [ANNOUNCE]: First release of nftables
Frans Pop
svc: failed to register lockdv1 RPC service (errno 97).
Sage Weil
Re: [2/3] POHMELFS: Documentation.
openbsd-misc
:
Netmaffia.hu
Tini Lányok AKCIÓBAN OTTHON
Ted Unangst
Re: OpenSMTPd actual development and integration
Paul M
Corrupted RAIDFrame device
nixlists
Re: OpenSMTPd actual development and integration
noreply
Rowiw újraindult!
git-commits-head
:
Linux Kernel Mailing List
Remove empty comment in acpi/power.c
Linux Kernel Mailing List
Linux 2.6.34-rc4
Linux Kernel Mailing List
ALSA: cosmetic: make hda intel interrupt name consistent with others
Linux Kernel Mailing List
swiotlb: replace architecture-specific swiotlb.h with linux/swiotlb.h
Linux Kernel Mailing List
x86 boot: only pick up additional EFI memmap if add_efi_memmap flag
Colocation donated by:
Syndicate