[Mono-devel-list] Mono.LinuxDiagnostics

anthony whalley tont at o2.ie
Tue Nov 23 10:54:40 EST 2004


Thanks Jon. 
I will bare your comments in mind when I manage 
to get some processes to apply bridge design to ;-)

I was also looking for suggestions on whether
anyone would have any issues with running /proc 
system approach as it is my understanding 
that it should be left in a disused lavatory with a sign on the door saying "Beware of the Leopard"

I also had a look in the bug list and 
http://bugzilla.ximian.com/show_bug.cgi?id=51445
seems related. Dick suggested using libproc but
Miguel seemed worried that this would create 
unwanted dependancies so the /proc file read would
be a compromise between the two.

Anyway I will let you know how I get on. 

PS. Mono.Appserver now has a load balancer and the web server is running from the CVS XSP. 
Brian and I need to merge our code trees and we may have something to look at. 

Regs

Tont 
 

----- Original Message -----
From: Jonathan Pryor <jonpryor at vt.edu>
Date: Tuesday, November 23, 2004 1:39 pm
Subject: Re: [Mono-devel-list] Mono.LinuxDiagnostics

> On Tue, 2004-11-23 at 10:19 +0000, anthony whalley wrote:
> > Hello Again.
> >     The Mono.AppServer needs 
> System.Diagnostics.PerformanceCounter and
> > it is not yet implemented. 
> > I have searched around and I think the best approach
> > for now would be to create a name space Mono.LinuxDiagnostics which
> > would read directly from 
> > /proc like top or ps does. 
> > 
> > Is there a better way to approach PerformanceCounter
> > implementations?
> 
> The *correct* approach is to implement the PerformanceCounter and
> related classes so that it will work on both Windows and Linux.
> Gratuitous incompatibilities should be avoided if at all possible.
> 
> This would likely be best done by using the Bridge design pattern:
> 
> 	internal interface IPerformanceCounter {/* ... */}
> 
> 	public class PerformanceCounter {
>        	private IPerformanceCounter impl;
> 
>        	public PerformanceCounter ()
>        	{
>                	this.impl = 
>                          
> PerfCounterFactory.CreatePerformanceCounter();        	}
> 
>        	public long Decrement () {return impl.Decrement();}
>        	// ...
> 	}
> 
> 	internal class LinuxPerformaceCounter : IPerformanceCounter 
> 	{/* ... */}
> 
> 	internal class WindowsPerformaceCounter : IPerformanceCounter 
> 	{/* ... */}
> 
> 	internal sealed class PerfCounterFactory {
>        	public IPerformancCounter CreatePerformaceCounter ()
>        	{
>                	// return appropriate IPerformaceCounter impl.
>        	}
> 	}
> 
> This will likely involve more work, but it will allow programs to be
> portable between Windows & Linux, increasing compatibility, and 
> reducingany special-case portability considerations (such as using
> PerformanceCounter on Windows but Mono.LinuxDiagnostics on Unix, which
> is a consideration I'm sure most developers would rather avoid).
> 
> - Jon
> 
> 
> 




More information about the Mono-devel-list mailing list