I have an application that consists of a managed C++ wrapper around an
unmanaged C++ "engine" that performs a very processor intensive task. In
the application I create two instances of the managed wrapper (and therefore
of the unmanaged engine) on separate threads so that it can be working on two
scenarios at the same time. The engine keeps track of certain counters so
that I can monitor it's progress.
However, I'm finding that the engine executes at different speeds on
different occasions when I run the application with exactly the same
scenarios. In fact, sometimes one instance of the engine runs at the speed
I'm expecting and the other runs at about one tenth of the normal speed, even
though they are instances of exactly the same code, running on a dual core
processor with nothing else running at the same time.
I find myself running the application, checking the speed, and, if it's not
running at the normal speed I shut it down, start it again, check the speed,
etc, until, for no apparent reason, it starts up running at full speed. It's
the only way I can find to get the application working at full potential on
both threads and it's very annoying!
Does anyone have any idea what might be causing this? I'm still a C++
beginner so I'm hoping this can be fixed with a compiler option or two.
I'm using VC++ 2005 on a Pentium D and Win2K.
Thanks in advance. 1 1370
However, I'm finding that the engine executes at different speeds on
different occasions when I run the application with exactly the same
scenarios. In fact, sometimes one instance of the engine runs at the
speed
I'm expecting and the other runs at about one tenth of the normal speed,
even
though they are instances of exactly the same code, running on a dual core
processor with nothing else running at the same time.
Does anyone have any idea what might be causing this? I'm still a C++
beginner so I'm hoping this can be fixed with a compiler option or two.
I'm using VC++ 2005 on a Pentium D and Win2K.
What are your threads doing? Are they working on the same data? Do they use
global data / file io/ synchronization mechanisms like mutexes, events or
critical sections?
There are a lot of things that influence the perfromance of parallel
programmed threads. We need some more info to help you.
--
Kind regards,
Bruno van Dooren MVP - VC++ http://msmvps.com/blogs/vanDooren br************* *********@hotma il.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: linvin333 |
last post by:
Hi,
Does function overloading affect the speed of execution of the program
?
If so what is the reason ?
How does it compare with a speed of a program using non-overloded
functions ?
Linny
|
by: gregbacchus |
last post by:
Hi,
Here's my problem: I want to write a stored procedure that returns all
records from a table that have a certain column starting with given
text. I however find that using LIKE and a variable always causes an
index scan... which is causing performance issues. My table has about
3.5M records.
Below is a test. In query analyser if I look at the execution plan for
the following it will come up as in index scan. However, if i just...
|
by: Klaus Johannes Rusch |
last post by:
Is the following code valid and supported by current implementations?
function somename() {
this.show = function () { document.write("somename called") }
}
var somename = new somename();
somename.show()
Note that the class name "somename" is reused for the variable name.
|
by: Grant Wagner |
last post by:
Given the following working code:
function attributes() {
var attr1 = arguments || '_';
var attr2 = arguments || '_';
return (
function (el1, el2) {
var value1 = el1 + el1;
var value2 = el2 + el2;
if (value1 > value2) return 1;
|
by: Peng Jian |
last post by:
I have a function that is called very very often.
Can I improve its efficiency by declaring its local variables to be static?
| |
by: kavi |
last post by:
Hello friends,
Could any one tell the way of calculating the speed of c program
execution?
|
by: William Ahern |
last post by:
So, I recently learned that Solaris doesn't, or doesn't seem, to provide
err.h. On some platforms err.h provides simple wrappers for error printing
to stderr. One of which, err(), has this signature:
void err(int exit_code, const char *fmt, ...);
It will print fmt + ... to stderr, tacking on a colon, the
result of strerror(errno), and a newline. Then it exits.
As a workaround, assuming that `fmt' will be passed as a string
|
by: John |
last post by:
Does the length of my C variable names have any affect, performance-wise, on
my final executable program? I mean, once compiled, etc., is there any
difference between these two:
number = 3;
n = 3;
I know its setting aside storage for the variable itself; does it also use
up more storage if the variable name is longer? I realize it would probably
take quite a lot of long variable names to make any impact if so, but I was
just curious...
|
by: Umesh |
last post by:
i want to calculate the time required to execute a program. Also i
want to calcute the time remaining for the execution of the program.
how can i do that?
pl mention some good websites for learning advanced C.thx.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |