[Mono-list] Network Interface // Performance counters

Timothy Parez tpsoftware@users.sourceforge.net
06 Aug 2003 10:00:25 +0200


--=-gJY3QfurINIzaPhAstzw
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Perhaps I should have mentioned that I haven't been working with Linux
for a very long time :)
Although I do know the /proc filesystem is something special :)

Timothy.
Op wo 06-08-2003, om 09:42 schreef Ivan Hawkes:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Tuesday 05 Aug 2003 11:06 pm, Timothy Parez wrote:
> > Hi,
> >
> > In .NET/Win2k I would use performance counters to
> >
> >   a.. Check the bandwith of the network
> >   b.. Check the bytes/sec upload
> >   c.. Check the bytes/sec download
> >   d.. Check the pakkets/sec upload
> >   e.. Check the pakkets/sec download
> > I would like to do the same thing but have it working on linux.
> > I don't assume performance counters are available?
> > So how would I do this ?
> >
> > Thnx
> > Timothy
> 
> This may be tricky under Mono because of the way performance counters are 
> provided by Windows. They are really just code that writes constantly to the 
> registry as far as I could tell. I had a few goes using them with C++ and the 
> ATL but in the end it was soooo much trouble I just got something to output 
> an XML file every 10 seconds instead. Slack, I know, but it solved the 
> problem :-)
> 
> I guess instead of using the registry these could be moved to the /proc 
> filesytem and the support libraries written to handle it like this. Windows 
> required you to also put either a COM interface on your service or use 
> something like sockets to comunicate with a DLL you supplied to pass the 
> counters along. Very messy. I'm sure Mono and Linux can do something a lot 
> nicer than that :-)
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.1 (GNU/Linux)
> 
> iQIVAwUBPzCxd/r1e7bH1pzBAQJwdg/+LZA0xIsfDMy/sIKKJEBBDhAKnwXkqctw
> n2q+eek+BYuObkCKh+UHdbszNOAJyX7ZCPx4z43cVSdvNc0M31lrdgQWPKOy7Rs3
> vBLuHSyyN4C2YVzc/AtOoDhT9ho6baEJCfimfHJvudcIMwl78OnrZiwwS7qEr/Vh
> bmmOci6Zq2VP8KKOh3ZBVOQ4zmf8QSe8tvwy0yTE5ad0Gd2dUC18f5Pn32cI3f10
> 9/cJwPduaZV4/eOnbwa7pd4HTpcslSQBNOj0h0z1qMl2CafaODEyUr3X585k7/Uy
> 0cNH2jm0qgCRYlnwbaT9/fKL3sTXwoM3yzvRZegRb8kx1aN0mNOWrMUJ//cf9uw3
> cZ6jd57zbzNq8fpTkH1fLqavtX6tLSZcSkdjLtllHAFGOKfcop9sZIOD36zwihpA
> Dyhy1nfiIieeo9c/+vAoa7hcEDzFxZ3r/WYQv7U9sod8G9lJcPtVHCDFxbW3PZfS
> Ial6cwgthR3+IUtvq2hZ7py55LWe4krIFXry7WsW8wTKtVpiSesBQK1P/Fec/0kn
> yTt7/5dqIeAUKabd8acGeaT3/E5jT3UsVcD9YtatMOChSLlgqLIsAkK9mOqAqFKQ
> UgVSKgkUyKDzYSbuc0o/AgXsp56yjEYCWBL8RDdYHeuK9PCaEiu+16O3LpNW42IT
> iSu0Gfa4BtQ=
> =Chqb
> -----END PGP SIGNATURE-----
> 

--=-gJY3QfurINIzaPhAstzw
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.0.7">
</HEAD>
<BODY>
Perhaps I should have mentioned that I haven't been working with Linux for a very long time :)<BR>
Although I do know the /proc filesystem is something special :)<BR>
<BR>
Timothy.<BR>
Op wo 06-08-2003, om 09:42 schreef Ivan Hawkes:
<BLOCKQUOTE TYPE=CITE>
<PRE><FONT COLOR="#737373"><I>-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 05 Aug 2003 11:06 pm, Timothy Parez wrote:
&gt; Hi,
&gt;
&gt; In .NET/Win2k I would use performance counters to
&gt;
&gt;   a.. Check the bandwith of the network
&gt;   b.. Check the bytes/sec upload
&gt;   c.. Check the bytes/sec download
&gt;   d.. Check the pakkets/sec upload
&gt;   e.. Check the pakkets/sec download
&gt; I would like to do the same thing but have it working on linux.
&gt; I don't assume performance counters are available?
&gt; So how would I do this ?
&gt;
&gt; Thnx
&gt; Timothy

This may be tricky under Mono because of the way performance counters are 
provided by Windows. They are really just code that writes constantly to the 
registry as far as I could tell. I had a few goes using them with C++ and the 
ATL but in the end it was soooo much trouble I just got something to output 
an XML file every 10 seconds instead. Slack, I know, but it solved the 
problem :-)

I guess instead of using the registry these could be moved to the /proc 
filesytem and the support libraries written to handle it like this. Windows 
required you to also put either a COM interface on your service or use 
something like sockets to comunicate with a DLL you supplied to pass the 
counters along. Very messy. I'm sure Mono and Linux can do something a lot 
nicer than that :-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iQIVAwUBPzCxd/r1e7bH1pzBAQJwdg/+LZA0xIsfDMy/sIKKJEBBDhAKnwXkqctw
n2q+eek+BYuObkCKh+UHdbszNOAJyX7ZCPx4z43cVSdvNc0M31lrdgQWPKOy7Rs3
vBLuHSyyN4C2YVzc/AtOoDhT9ho6baEJCfimfHJvudcIMwl78OnrZiwwS7qEr/Vh
bmmOci6Zq2VP8KKOh3ZBVOQ4zmf8QSe8tvwy0yTE5ad0Gd2dUC18f5Pn32cI3f10
9/cJwPduaZV4/eOnbwa7pd4HTpcslSQBNOj0h0z1qMl2CafaODEyUr3X585k7/Uy
0cNH2jm0qgCRYlnwbaT9/fKL3sTXwoM3yzvRZegRb8kx1aN0mNOWrMUJ//cf9uw3
cZ6jd57zbzNq8fpTkH1fLqavtX6tLSZcSkdjLtllHAFGOKfcop9sZIOD36zwihpA
Dyhy1nfiIieeo9c/+vAoa7hcEDzFxZ3r/WYQv7U9sod8G9lJcPtVHCDFxbW3PZfS
Ial6cwgthR3+IUtvq2hZ7py55LWe4krIFXry7WsW8wTKtVpiSesBQK1P/Fec/0kn
yTt7/5dqIeAUKabd8acGeaT3/E5jT3UsVcD9YtatMOChSLlgqLIsAkK9mOqAqFKQ
UgVSKgkUyKDzYSbuc0o/AgXsp56yjEYCWBL8RDdYHeuK9PCaEiu+16O3LpNW42IT
iSu0Gfa4BtQ=
=Chqb
-----END PGP SIGNATURE-----
</I></FONT></PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-gJY3QfurINIzaPhAstzw--