|
I used one software for performance measurement.
It says exactly oppsite of what we concluded last time.
|
|
|
|
|
2 questions :
1) how does that tool measure the perf ? (consider spoting the accuracy)
2) why do you need that much precision ? can't you refer to the assembler code generated by the compiler ?
|
|
|
|
|
for small values (10) there will not be a significative difference.
Try with 1000000 or more iterations; maybe at this size you will be able to use a simple chronometer.
or try this simple class CProfiler[^] which works well to profile simple functions.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
HI,
The link u have mentioned is really helpful..Sooner I will publish the results...Thanx a lot for valuable input !
Vikrams
|
|
|
|
|
yes, it's called a Profiler.
it used to be bundled with Visual Studio 6. in newer version ( VS2003 and VS 2005 ( i think ) ) it's not there, you have to go to a 3rd party ( devparter profiler ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
|
what was wrong with THIS[^] ?
|
|
|
|
|
hi
i have a vc++6 MFC app. in my main i start a thread that connects to the wmi of a host, it uses
IWbemLocator *pLoc
IWbemServices *pSvc
back in the main, once the thread has finished connecting to the wmi of the host, it is queryied but the two global variables above are "empty", this is because you cannot use COM interfaces on multiple threads and each thread must initialize COM itself and onyl use local COM objects afaik.
so i think marshalling will have to be used but i dont know where to start on how to implement it
please help
|
|
|
|
|
Whenever you cross apartment boundaries you have to marshal the interface.
An apartment is, in simple words, a thread that has made a successful call to ::CoInitialize() or similar. Each thread that will use COM in any way have to initialize COM by calling ::CoInitialize(), which tells the COM subsystem that this-apartment-is-a-single-threaded-apartment (STA). If you want your thread to be added the the multithreaded apartment of the process (MTA), because there can be only one, you have to call ::CoInitializeEx() with COINIT_MULTITRHEADED.
The easiest way to marshal an interface is to use ::CoMarshalInterThreadInterfaceInStream()[^] and ::CoGetInterfaceAndReleaseStream.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
so will i get away with using CoInitializeEx() with COINIT_MULTITRHEADED and not having to use marshalling?
|
|
|
|
|
no!
the CoInitializeEx() with COINIT_MULTITRHEADED tells what type of apartment do you wishes to use in yourcase MTA.
unfortunately, you will have to do marshaling yourself,use the 2 methods suggested above
hope it helps
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
viperlogic wrote: so will i get away with using CoInitializeEx() with COINIT_MULTITRHEADED and not having to use marshalling?
In theory this is possible and usually requires the free-threaded-marshaler (FTM) and you also have to be aware that when your thread that created the server finishes it has to call ::CoUninitalize() which unloads the COM library for that thread which can get you into trouble.
It also depends on the server whether it supports free-threading or not.
The use of free-threading is usually complicated and not for the faint-hearted.
If you really want to create the server to be created in a secondary thread, I suggest you create the server and marshal the interface back to the main thread, or whatever thread you like, by ::CoMarshalInterThreadInterfaceInStream() and ::CoGetInterfaceAndReleaseStream().
You can alert the receiving thread by posting a message or setting an event informing the thread that the server is created and the interface can be retrieved with ::CoGetInterfaceAndReleaseStream().
This is not so complicated compared to free-threading. In other words: a good place to start.
N.B. since this kind of questions are COM related you should post in the COM forum instead.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
Hi,
I have to draw line in screen.
I tried a lot of things,but it does not draw.Following functions i used in my codings.
void CPerfGrapView::OnDraw(CDC* pDC)
{
// TODO: add draw code here
GetClientRect(&mClientArea);
pMemDC->FillRect(&mClientArea,&CBrush(RGB(66,60,66)));
pMemDC->SetBkMode(TRANSPARENT);
CFont *pOFont = pMemDC->SelectObject(&TextFont);
if(!pOFont)
{
AfxMessageBox(IERR_GDIFAIL);
return;
}
CPen *pOPen = pMemDC->SelectObject(&penGraph);
pMemDC->SetBkColor(RGB(0,0,0));
pMemDC->SetTextColor(RGB(255,255,255));
pMemDC->TextOut(::AlignX(300,mClientArea),::AlignY(30,mClientArea),"Perfor");
pMemDC->SelectObject(&penGraph);
//pMemDC->TextOut(500,400,"PERFORMANCE GRAPH VIEW");
}
///
int CPerfGrapView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
pMemDC = new CDC;
if(!pMemDC)
{
AfxMessageBox(IERR_MEMFAIL);
return -1;
}
pBitmap = new CBitmap;
if(!pBitmap)
{
AfxMessageBox(IERR_MEMFAIL);
return -1;
}
CDC *pDC = GetDC();
pMemDC->CreateCompatibleDC(pDC);
pBitmap->CreateCompatibleBitmap (pDC, 800, 640 );
pMemDC->SelectObject( pBitmap );
if(!TextFont.CreateFont(14,0,0,0,400,FALSE,FALSE,0,ANSI_CHARSET,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,DEFAULT_PITCH|FF_ROMAN,NULL))
{
AfxMessageBox(IERR_GDIFAIL);
return -1;
}
if(!penGraph.CreatePen(NULL,NULL,RGB(255,255,255)))
{
AfxMessageBox(IERR_GDIFAIL);
return -1;
}
ReleaseDC(pDC);
return 0;
}
BOOL CPerfGrapView::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
CBrush brBkGround(RGB(66,60,66));
CBrush brBkGround(RGB(0,0,0));
CBrush *pbrOld = pDC->SelectObject(&brBkGround);
CRect rc;
pDC->GetClipBox(&rc);
pDC->PatBlt(rc.left, rc.top, rc.Width(),rc.Height(), PATCOPY);
pDC->SelectObject(pbrOld);
return TRUE;
//return CView::OnEraseBkgnd(pDC);
}
I declared all variables in my header file.
This is my Coding.But it does not draw anything in screen.Can u find it.
It simply shows the Blank Background.
|
|
|
|
|
It looks like you are drawing everything on your memory DC but you forgot to paste everything back on your CDC in OnDraw.
|
|
|
|
|
Hi Anu_Bala,
your code draw only background
and if change pMemDc it darw pMemDC->TextOut(::AlignX(300,mClientArea),::AlignY(30,mClientArea),"Perfor");
But pMemDC->TextOut(300,30,"Perfor",6);
with white color
and another variables pMemDC,pBitmap
Can you be more specific
|
|
|
|
|
i want to ger harware identification(maunfacturer serial number model types )of my hardware (motherboard network card processor hard disk...) in linux oerating system
am
|
|
|
|
|
I kindly ask you to try asking that in a more appropiate forum. This a Visual C++ forum!
|
|
|
|
|
Hi All,
I am working on a project where i need to mix audio and video files. Is there any windows api available for this?
I tried in DirectShow. I couldnt find any particular interface which does this.
Can anyone help me on this?
Thanks and Regards,
Poornima
|
|
|
|
|
|
Hi
I follow the options for the beta from the readme. I get the following error:
vc\include\vld.h(65) : error C2146: syntax error : missing ';' before identifier 'VLDDisable'
What causes this?
cheers
-- modified at 7:33 Tuesday 4th April, 2006
|
|
|
|
|
There is a ';' missing before 'VLDDisable'
Seriously, why do you think error messages exists ? The error message is described explicitely, there is a reason for that: yes, you can try to fix the error yourself.
Now, if you cannot, be more explicit, post some code, ...
How can we correct the problem just by seing the error message (except saying exactly the same as the error message) ?
|
|
|
|
|
Here's the code:
#include "stdafx.h"<br />
;<br />
#include "vld.h"
If it were that simple....
cheers
-- modified at 7:51 Tuesday 4th April, 2006
|
|
|
|
|
What's this ? At least post some code from where the error is coming from. I mean it is not by including two include that we can see the error.
And BTW, what is this ';' in the middle of nowhere ? It's not really an error but why put ';' where you don't need to put one ?
thepersonof wrote: If it were that simple....
In general yes, it is simple: you have a file and a line number so you can see what line causes the error. Then starting from this point you can look why you have an error.
|
|
|
|
|
but in that case, the error could happen in the .h files
but i totally agree that the sample wasn't showing at all the issuing code...
|
|
|
|
|
v2.0 wrote: but in that case, the error could happen in the .h files
Yep sure but if you look at his first message, the error was clearly in the vld.h file at line 65. I hardly see 65 lines of code in the code snippet he posted .
Furthemore, I looked at the source code from this VLD project and on line 65, there is nothing, only comments. So I don't know what he did with the code.
|
|
|
|