Performance monitoring.

  • Thread starter Thread starter nicolas.lelievre
  • Start date Start date
N

nicolas.lelievre

Hi,

I get an application and I don't have the source code but I would like
to know if there is any leack of memory in this application.
So I would like to code an application running in background which will
log the memory and the processor state .
Do you know if it's possible to get some information about the memory
used in the device, the processor used, and more particulary by a
specific application.

Thanks a lot,
 
I was thinking of that but the main probleme is taht I want to minitor
an application who send data over GPRS and you cannot send data to the
sync and to the network....
So I need a stand alone application on the device...
 
Hi,
I found my answer !!

This is the code :

* First :

[StructLayout(LayoutKind.Sequential)]
public struct MEMORYSTATUS
{
public uint dwLength;
public uint dwMemoryLoad;
public uint dwTotalPhys;
public uint dwAvailPhys;
public uint dwTotalPageFile;
public uint dwAvailPageFile;
public uint dwTotalVirtual;
public uint dwAvailVirtual;
}

[DllImport("coredll")]
static extern void GlobalMemoryStatus(ref MEMORYSTATUS buf);

* and then :

MEMORYSTATUS memSt = new MEMORYSTATUS();
GlobalMemoryStatus(ref memSt);

Available Page File (kb): (memSt.dwAvailPageFile
/ 1024)
Available Physical Memory (kb), (memSt.dwAvailPhys / 1024)
Available Virtual Memory (kb), (memSt.dwAvailVirtual /
1024)
Size of structur : memSt.dwLength
Memory In Use : memSt.dwMemoryLoad.
Total Page Size (kb):
(memSt.dwTotalPageFile / 1024)
Total Physical Memory (kb), (memSt.dwTotalPhys / 1024)
Total Virtual Memory (kb), (memSt.dwTotalVirtual /
1024)

(e-mail address removed) a écrit :
 
Except that gives a very incomplete picture. If the GCHeap has 2MB
allocatred, objects could be getting created and destroyed inside the app
and GlobalMemoryStatus will be unchanged.


-Chris



Hi,
I found my answer !!

This is the code :

* First :

[StructLayout(LayoutKind.Sequential)]
public struct MEMORYSTATUS
{
public uint dwLength;
public uint dwMemoryLoad;
public uint dwTotalPhys;
public uint dwAvailPhys;
public uint dwTotalPageFile;
public uint dwAvailPageFile;
public uint dwTotalVirtual;
public uint dwAvailVirtual;
}

[DllImport("coredll")]
static extern void GlobalMemoryStatus(ref MEMORYSTATUS buf);

* and then :

MEMORYSTATUS memSt = new MEMORYSTATUS();
GlobalMemoryStatus(ref memSt);

Available Page File (kb): (memSt.dwAvailPageFile
/ 1024)
Available Physical Memory (kb), (memSt.dwAvailPhys / 1024)
Available Virtual Memory (kb), (memSt.dwAvailVirtual /
1024)
Size of structur : memSt.dwLength
Memory In Use : memSt.dwMemoryLoad.
Total Page Size (kb):
(memSt.dwTotalPageFile / 1024)
Total Physical Memory (kb), (memSt.dwTotalPhys / 1024)
Total Virtual Memory (kb), (memSt.dwTotalVirtual /
1024)

(e-mail address removed) a écrit :
 
And so what do you propose ?

And I think that if there is a memory leak inside of the app, I will be
able to see it, no ?

Except that gives a very incomplete picture. If the GCHeap has 2MB
allocatred, objects could be getting created and destroyed inside the app
and GlobalMemoryStatus will be unchanged.


-Chris



Hi,
I found my answer !!

This is the code :

* First :

[StructLayout(LayoutKind.Sequential)]
public struct MEMORYSTATUS
{
public uint dwLength;
public uint dwMemoryLoad;
public uint dwTotalPhys;
public uint dwAvailPhys;
public uint dwTotalPageFile;
public uint dwAvailPageFile;
public uint dwTotalVirtual;
public uint dwAvailVirtual;
}

[DllImport("coredll")]
static extern void GlobalMemoryStatus(ref MEMORYSTATUS buf);

* and then :

MEMORYSTATUS memSt = new MEMORYSTATUS();
GlobalMemoryStatus(ref memSt);

Available Page File (kb): (memSt.dwAvailPageFile
/ 1024)
Available Physical Memory (kb), (memSt.dwAvailPhys / 1024)
Available Virtual Memory (kb), (memSt.dwAvailVirtual /
1024)
Size of structur : memSt.dwLength
Memory In Use : memSt.dwMemoryLoad.
Total Page Size (kb):
(memSt.dwTotalPageFile / 1024)
Total Physical Memory (kb), (memSt.dwTotalPhys / 1024)
Total Virtual Memory (kb), (memSt.dwTotalVirtual /
1024)

(e-mail address removed) a écrit :
I was thinking of that but the main probleme is taht I want to minitor
an application who send data over GPRS and you cannot send data to the
sync and to the network....
So I need a stand alone application on the device...
 
0. How are you going to define a "leak" as opposed to simple poor memory
management?
1. If you don't have the source, detecting a leak isn't much use. You can't
fix it.
2. Managed code doesn't typically "leak" as that's the point of it being
managed.
3. I told you what I propose - RPM gives far better statistics. If you
simply can't test in the lab and you can't instrument the source with calls
to ask the GC what it's allocation is, you're not going to get much.

-Chris



And so what do you propose ?

And I think that if there is a memory leak inside of the app, I will be
able to see it, no ?

Except that gives a very incomplete picture. If the GCHeap has 2MB
allocatred, objects could be getting created and destroyed inside the app
and GlobalMemoryStatus will be unchanged.


-Chris



Hi,
I found my answer !!

This is the code :

* First :

[StructLayout(LayoutKind.Sequential)]
public struct MEMORYSTATUS
{
public uint dwLength;
public uint dwMemoryLoad;
public uint dwTotalPhys;
public uint dwAvailPhys;
public uint dwTotalPageFile;
public uint dwAvailPageFile;
public uint dwTotalVirtual;
public uint dwAvailVirtual;
}

[DllImport("coredll")]
static extern void GlobalMemoryStatus(ref MEMORYSTATUS buf);

* and then :

MEMORYSTATUS memSt = new MEMORYSTATUS();
GlobalMemoryStatus(ref memSt);

Available Page File (kb): (memSt.dwAvailPageFile
/ 1024)
Available Physical Memory (kb), (memSt.dwAvailPhys / 1024)
Available Virtual Memory (kb), (memSt.dwAvailVirtual /
1024)
Size of structur : memSt.dwLength
Memory In Use : memSt.dwMemoryLoad.
Total Page Size (kb):
(memSt.dwTotalPageFile / 1024)
Total Physical Memory (kb), (memSt.dwTotalPhys / 1024)
Total Virtual Memory (kb), (memSt.dwTotalVirtual /
1024)

(e-mail address removed) a écrit :
I was thinking of that but the main probleme is taht I want to minitor
an application who send data over GPRS and you cannot send data to the
sync and to the network....
So I need a stand alone application on the device...
 
Back
Top