[Mono-dev] [PATCH] Network Performance Counters

Joel Reed joelwreed at gmail.com
Tue Sep 29 07:23:59 EDT 2009


Thanks for the feedback Gonzalo. Will update accordingly. I did
valgrind it and everything looked good - will review again.

Jr

On 9/29/09, Gonzalo Paniagua Javier <gonzalo.mono at gmail.com> wrote:
> On Mon, 2009-09-28 at 22:11 -0400, Joel Reed wrote:
>> The attached patch implements 3 "Network Interface" performance category
>> counters. The counters are "Bytes Received/sec", "Bytes Sent/sec", and
>> "Bytes Total/sec". A sample program using these counters and sample
>> output is attached as well.
>>
>> This information is obtained by reading /proc/net/dev.
>
> The value returned by mono_networkinterface_list() is not freed
> properly. In get_networkinterface_instance() you do:
> 	g_free (buf);
> but it should be something like:
> 	for (i = 0; i < count; i++)
> 		g_free (buf [i]);
>
> I would make mono_networkinterface_list() return a null-terminated array
> and then use g_strfreev () on it.
>
> As for mono_networkinterface_list(), I think it belongs somewhere else
> perhaps utils/mono-networkinterfaces.c or in io-layer. If you want to go
> the io-layer route:
> mono_networkinterface_list => WSAIoctl(SIO_GET_INTERFACE_LIST_EX)
> mono_network_get_data => GetIfTable() from Iphlpapi.dll
>
> This way it would work in windows and linux by now and future additions
> should stick to the same interface.
>
> -Gonzalo
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>

-- 
Sent from my mobile device


More information about the Mono-devel-list mailing list