ports/157569: Fix missing load reporting for FreeBSD, enable kqueue for FreeBSD

Michael Gmelin freebsd at grem.de
Fri Jun 3 20:40:11 UTC 2011


>Number:         157569
>Category:       ports
>Synopsis:       Fix missing load reporting for FreeBSD, enable kqueue for FreeBSD
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 03 20:40:10 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Michael Gmelin
>Release:        FreeBSD 8.1 RELEASE amd64
>Organization:
Grem Equity GmbH
>Environment:
FreeBSD server.grem.de 8.1-RELEASE-p2 FreeBSD 8.1-RELEASE-p2 #2 r216068: Tue Nov 30 03:00:30 CET 2010 root at bsdsource.grem.de:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
IceGrid nodes can report the load of the machine they're running on over a Processing facet. This information can be e.g. used for load balancing. On FreeBSD the load reported is always "-1 -1 -1", because the ifdefs for FreeBSD are missing in PlatformInfo.cpp.

I informed zeroc.com about this, but if at all this will be part of the next release, so implementing the feature as a patch to the port skeleton makes sense.

See also: http://www.zeroc.com/forums/help-center/5380-freebsd-support-icegridnode-question-regarding-load.html

The Ice networking selector code supports EPOLL on linux and KQUEUE on Mac OS X for better selector performance. Unfortunately it falls back to simple polling on FreeBSD. The kqueue interface of Mac OS X is identical to FreeBSD (at least in the relevant part) and a simple #ifdef enables the feature on FreeBSD as well.

I informed zeroc.com about this, but if at all this will be part of the next release, so implementing the feature as a patch to the port skeleton makes sense.

See also: http://www.zeroc.com/forums/help-center/5381-freebsd-support-kqueue-networking-selector-code.html

>How-To-Repeat:
Set up an ice grid and check the node load reported by icegridadmin. Use ice in a high load environment.
>Fix:
Apply the patch (it adds the missing #ifdef statements to PlatformInfo.cpp and Network.h)

Patch attached with submission follows:

===> Generating patch
===> Viewing diff with more
diff -ruN --exclude=CVS /tmp/ice/devel/Ice/Makefile /usr/ports/devel/ice/Makefile
--- /tmp/ice/devel/Ice/Makefile	2010-08-15 14:02:57.000000000 +0200
+++ /usr/ports/devel/ice/Makefile	2011-06-03 22:21:06.000000000 +0200
@@ -7,6 +7,7 @@
 
 PORTNAME=	Ice
 PORTVERSION=	3.4.1
+PORTREVISION=   1
 CATEGORIES=	devel
 MASTER_SITES=	http://www.zeroc.com/download/Ice/3.4/
 
diff -ruN --exclude=CVS /tmp/ice/devel/Ice/files/patch-Network.h /usr/ports/devel/ice/files/patch-Network.h
--- /tmp/ice/devel/Ice/files/patch-Network.h	1970-01-01 01:00:00.000000000 +0100
+++ /usr/ports/devel/ice/files/patch-Network.h	2011-06-03 22:20:38.000000000 +0200
@@ -0,0 +1,11 @@
+--- cpp/src/Ice/Network.h.orig	2011-06-03 21:25:21.000000000 +0200
++++ cpp/src/Ice/Network.h	2011-06-03 21:25:21.000000000 +0200
+@@ -36,7 +36,7 @@
+ 
+ #if defined(__linux) && !defined(ICE_NO_EPOLL)
+ #   define ICE_USE_EPOLL 1
+-#elif defined(__APPLE__) && !defined(ICE_NO_KQUEUE)
++#elif (defined(__APPLE__) || defined(__FreeBSD__)) && !defined(ICE_NO_KQUEUE)
+ #   define ICE_USE_KQUEUE 1
+ #elif defined(_WIN32)
+ #  if !defined(ICE_NO_IOCP)
diff -ruN --exclude=CVS /tmp/ice/devel/Ice/files/patch-PlatformInfo.cpp /usr/ports/devel/ice/files/patch-PlatformInfo.cpp
--- /tmp/ice/devel/Ice/files/patch-PlatformInfo.cpp	1970-01-01 01:00:00.000000000 +0100
+++ /usr/ports/devel/ice/files/patch-PlatformInfo.cpp	2011-06-03 22:20:35.000000000 +0200
@@ -0,0 +1,29 @@
+--- cpp/src/IceGrid/PlatformInfo.cpp.orig	2011-06-03 21:07:43.000000000 +0200
++++ cpp/src/IceGrid/PlatformInfo.cpp	2011-06-03 21:07:43.000000000 +0200
+@@ -24,7 +24,7 @@
+ #   include <pdhmsg.h> // For PDH_MORE_DATA
+ #else
+ #   include <sys/utsname.h>
+-#   if defined(__APPLE__)
++#   if defined(__APPLE__) || defined(__FreeBSD__)
+ #      include <sys/sysctl.h>
+ #   elif defined(__sun)
+ #      include <sys/loadavg.h>
+@@ -222,7 +222,7 @@
+     SYSTEM_INFO sysInfo;
+     GetSystemInfo(&sysInfo);
+     _nProcessors = sysInfo.dwNumberOfProcessors;
+-#elif defined(__APPLE__)
++#elif defined(__APPLE__) || defined(__FreeBSD__)
+     static int ncpu[2] = { CTL_HW, HW_NCPU };
+     size_t sz = sizeof(_nProcessors);
+     if(sysctl(ncpu, 2, &_nProcessors, &sz, 0, 0) == -1)
+@@ -446,7 +446,7 @@
+     info.avg1 = static_cast<float>(_last1Total) / _usages1.size() / 100.0f;
+     info.avg5 = static_cast<float>(_last5Total) / _usages5.size() / 100.0f;
+     info.avg15 = static_cast<float>(_last15Total) / _usages15.size() / 100.0f;
+-#elif defined(__sun) || defined(__linux) || defined(__APPLE__)
++#elif defined(__sun) || defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
+     //
+     // We use the load average divided by the number of
+     // processors to figure out if the machine is busy or
===> Done


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list