On 07/11/10 18:24, Kostik Belousov wrote:
> On Fri, Jul 09, 2010 at 01:03:14PM +1000, Lawrence Stewart wrote:
>> On 06/18/10 11:57, Lawrence Stewart wrote:
>>> On 06/17/10 17:13, Kostik Belousov wrote:
On Thu, Jun 17, 2010 at 12:38:08PM +1000, Lawrence Stewart wrote:
> On 06/14/10 20:43, K
On Fri, Jul 09, 2010 at 01:03:14PM +1000, Lawrence Stewart wrote:
> On 06/18/10 11:57, Lawrence Stewart wrote:
> > On 06/17/10 17:13, Kostik Belousov wrote:
> >> On Thu, Jun 17, 2010 at 12:38:08PM +1000, Lawrence Stewart wrote:
> >>> On 06/14/10 20:43, Kostik Belousov wrote:
> > [snip]
> Or, y
On 06/18/10 11:57, Lawrence Stewart wrote:
> On 06/17/10 17:13, Kostik Belousov wrote:
>> On Thu, Jun 17, 2010 at 12:38:08PM +1000, Lawrence Stewart wrote:
>>> On 06/14/10 20:43, Kostik Belousov wrote:
> [snip]
Or, you could ditch the sum at all, indeed using ({}) and returning the
result
On 06/18/10 22:08, Robert Watson wrote:
On Fri, 18 Jun 2010, Lawrence Stewart wrote:
True but I figured on large SMP systems where the potential to process
more is likely, 32bit counters per cpu may be enough to avoid overflow
but the aggregate number of events may exceed a 32bit variable. I
s
On Fri, 18 Jun 2010, Lawrence Stewart wrote:
True but I figured on large SMP systems where the potential to process more
is likely, 32bit counters per cpu may be enough to avoid overflow but the
aggregate number of events may exceed a 32bit variable. I suspect you're
right though and that if
On 06/17/10 17:13, Kostik Belousov wrote:
On Thu, Jun 17, 2010 at 12:38:08PM +1000, Lawrence Stewart wrote:
On 06/14/10 20:43, Kostik Belousov wrote:
[snip]
Or, you could ditch the sum at all, indeed using ({}) and returning the
result. __typeof is your friend to select proper type of accumula
On Thu, 17 Jun 2010, Kostik Belousov wrote:
On Thu, Jun 17, 2010 at 12:38:08PM +1000, Lawrence Stewart wrote:
I've tested the above and it works. I also prefer the idea of having
DPCPU_SUM return the sum so that you can do "var = DPCPU_SUM(...)". My
only concern with this method is that the cal
On Thu, Jun 17, 2010 at 12:38:08PM +1000, Lawrence Stewart wrote:
> On 06/14/10 20:43, Kostik Belousov wrote:
> >On Mon, Jun 14, 2010 at 08:34:15PM +1000, Lawrence Stewart wrote:
> >>On 06/14/10 18:52, Kostik Belousov wrote:
> >>>On Mon, Jun 14, 2010 at 11:52:49AM +1000, Lawrence Stewart wrote:
> >
On 06/14/10 20:43, Kostik Belousov wrote:
On Mon, Jun 14, 2010 at 08:34:15PM +1000, Lawrence Stewart wrote:
On 06/14/10 18:52, Kostik Belousov wrote:
On Mon, Jun 14, 2010 at 11:52:49AM +1000, Lawrence Stewart wrote:
On 06/13/10 20:10, Pawel Jakub Dawidek wrote:
On Sun, Jun 13, 2010 at 02:39:5
On Mon, 14 Jun 2010, John Baldwin wrote:
On Monday 14 June 2010 9:50:10 am m...@freebsd.org wrote:
[bde wrote]
BTW, one reason I liked BSD code more than gnu code is that it didn't
use so many macros. Macros should only exist when they are not just
syntactic sugar, like DPCPU_SUM() and unlike
On Monday 14 June 2010 9:50:10 am m...@freebsd.org wrote:
> > BTW, one reason I liked BSD code more than gnu code is that it didn't
> > use so many macros. Macros should only exist when they are not just
> > syntactic sugar, like DPCPU_SUM() and unlike CPU_FOREACH().
>
> As a style question, I do
> BTW, one reason I liked BSD code more than gnu code is that it didn't
> use so many macros. Macros should only exist when they are not just
> syntactic sugar, like DPCPU_SUM() and unlike CPU_FOREACH().
As a style question, I do understand (generally) why too many macros
make the code confusing.
On Sunday 13 June 2010 9:41:38 am Lawrence Stewart wrote:
> On 06/13/10 20:10, Pawel Jakub Dawidek wrote:
> > On Sun, Jun 13, 2010 at 02:39:55AM +, Lawrence Stewart wrote:
> >> Author: lstewart
> >> Date: Sun Jun 13 02:39:55 2010
> >> New Revision: 209119
> >> URL: http://svn.freebsd.org/change
On Sun, 13 Jun 2010, Lawrence Stewart wrote:
On 06/13/10 20:10, Pawel Jakub Dawidek wrote:
On Sun, Jun 13, 2010 at 02:39:55AM +, Lawrence Stewart wrote:
Log:
Add a utility macro to simplify calculating an aggregate sum from a
DPCPU
counter variable.
Sponsored by:FreeBSD
On Sun, 13 Jun 2010, Gabor Kovesdan wrote:
+/*
+ * Utility macros.
+ */
+#define DPCPU_SUM(n, var, sum)
\
+do {
\
+ (sum) = 0; \
+ u_int i;\
+ CPU_FOREACH(i)
On Mon, Jun 14, 2010 at 08:34:15PM +1000, Lawrence Stewart wrote:
> On 06/14/10 18:52, Kostik Belousov wrote:
> >On Mon, Jun 14, 2010 at 11:52:49AM +1000, Lawrence Stewart wrote:
> >>On 06/13/10 20:10, Pawel Jakub Dawidek wrote:
> >>>On Sun, Jun 13, 2010 at 02:39:55AM +, Lawrence Stewart wrote:
On 06/14/10 18:52, Kostik Belousov wrote:
On Mon, Jun 14, 2010 at 11:52:49AM +1000, Lawrence Stewart wrote:
On 06/13/10 20:10, Pawel Jakub Dawidek wrote:
On Sun, Jun 13, 2010 at 02:39:55AM +, Lawrence Stewart wrote:
[snip]
Modified: head/sys/sys/pcpu.h
===
On Mon, Jun 14, 2010 at 11:52:49AM +1000, Lawrence Stewart wrote:
> On 06/13/10 20:10, Pawel Jakub Dawidek wrote:
> >On Sun, Jun 13, 2010 at 02:39:55AM +, Lawrence Stewart wrote:
> [snip]
> >>
> >>Modified: head/sys/sys/pcpu.h
> >>
On Mon, Jun 14, 2010 at 11:52:49AM +1000, Lawrence Stewart wrote:
> Given that the DPCPU variable name space is flat and variable names have
> to be unique, perhaps something like the following would address the
> concerns raised?
>
> #define DPCPU_SUM(n, var, sum)
On 06/13/10 20:10, Pawel Jakub Dawidek wrote:
On Sun, Jun 13, 2010 at 02:39:55AM +, Lawrence Stewart wrote:
[snip]
Modified: head/sys/sys/pcpu.h
==
--- head/sys/sys/pcpu.h Sun Jun 13 01:27:29 2010(r209118)
On Sun, Jun 13, 2010 at 01:59:11PM +, m...@freebsd.org wrote:
>
> (Relevant but almost a thread hijack):
>
> At Isilon we've run into a lot of problems with variable declarations
> in macros, especially with -Wshadow turned on. We ended up
> backporting __COUNTER__ from later versions of gcc
On Sun, Jun 13, 2010 at 01:59:11PM +, m...@freebsd.org wrote:
> On Sun, Jun 13, 2010 at 10:10 AM, Pawel Jakub Dawidek
> wrote:
> > On Sun, Jun 13, 2010 at 02:39:55AM +, Lawrence Stewart wrote:
> >> Author: lstewart
> >> Date: Sun Jun 13 02:39:55 2010
> >> New Revision: 209119
> >> URL: ht
On Sun, Jun 13, 2010 at 10:10 AM, Pawel Jakub Dawidek wrote:
> On Sun, Jun 13, 2010 at 02:39:55AM +, Lawrence Stewart wrote:
>> Author: lstewart
>> Date: Sun Jun 13 02:39:55 2010
>> New Revision: 209119
>> URL: http://svn.freebsd.org/changeset/base/209119
>>
>> Log:
>> Add a utility macro to
On 06/13/10 20:10, Pawel Jakub Dawidek wrote:
On Sun, Jun 13, 2010 at 02:39:55AM +, Lawrence Stewart wrote:
Author: lstewart
Date: Sun Jun 13 02:39:55 2010
New Revision: 209119
URL: http://svn.freebsd.org/changeset/base/209119
Log:
Add a utility macro to simplify calculating an aggregate
On 06/13/10 20:20, Gabor Kovesdan wrote:
+/*
+ * Utility macros.
+ */
+#define DPCPU_SUM(n, var, sum) \
+do { \
+ (sum) = 0; \
+ u_int i; \
+ CPU_FOREACH(i) \
+ (sum) += (DPCPU_ID_PTR(i, n))->var; \
+} while (0)
I'd suggest first swapping variable declaration and '(sum) = 0;'.
Also using 'i'
+/*
+ * Utility macros.
+ */
+#define DPCPU_SUM(n, var, sum) \
+do { \
+ (sum) = 0; \
+ u_int i;
On Sun, Jun 13, 2010 at 02:39:55AM +, Lawrence Stewart wrote:
> Author: lstewart
> Date: Sun Jun 13 02:39:55 2010
> New Revision: 209119
> URL: http://svn.freebsd.org/changeset/base/209119
>
> Log:
> Add a utility macro to simplify calculating an aggregate sum from a DPCPU
> counter variab
Author: lstewart
Date: Sun Jun 13 02:39:55 2010
New Revision: 209119
URL: http://svn.freebsd.org/changeset/base/209119
Log:
Add a utility macro to simplify calculating an aggregate sum from a DPCPU
counter variable.
Sponsored by: FreeBSD Foundation
Reviewed by: jhb, rpaulo, rwatson (pr
28 matches
Mail list logo