|
-
May 15th, 2002, 10:24 AM
#1
Thread Starter
Hyperactive Member
Speed up?
Anyone see a way to speed this function up??
Code:
void MpEvent(UINT32 eventID, UINT32 buffer)
{
int l;
UINT32 *row;
if(mlb.logBuffer != NULL)
{
row = mlb.logBuffer[mlb.numEvent];
row[0] = HWCLK32BIT;
row[1] = SWCLK32BIT;
row[2] = eventID;
row[3] = buffer;
++mlb.numEvent;
/* check to see if the end of the log buffer was reached */
if(mlb.numEvent >= mlb.maxEvents)
{
mlb.looped = TRUE;
mlb.numEvent = 0;
}
}
else
{
/* We should never get here because the only way to free the log buffer
* is by calling MpLogFree, which turns logging off as well */
printf("There is no buffer allocated for main path event logging\n");
}
}
Any help appreciated...
Thanks
Bill
-
May 15th, 2002, 04:44 PM
#2
Frenzied Member
Is it that slow than?
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
May 16th, 2002, 09:32 AM
#3
Thread Starter
Hyperactive Member
no it really isnt too slow, but all the more faster is better...
I am thinking of putting that whole function into assembly. The compiler is not very efficent, keeps recalculating the address of mlb.numEvent, when it really only needs to do it once and store that in a register, dumb thing. so that should give me a performance boost of sorts.
-
May 16th, 2002, 11:24 AM
#4
PowerPoster
Maybe it'll be a bit faster if you replace
PHP Code:
if(mlb.numEvent >= mlb.maxEvents)
{
mlb.looped = TRUE;
mlb.numEvent = 0;
}
with
PHP Code:
mlb.numEvent >= mlb.maxEvents ? mlb.looped = TRUE : mlb.numEvent = 0;
-
May 16th, 2002, 02:30 PM
#5
Thread Starter
Hyperactive Member
Sorry that wouldn't work, the ? and : is a "if a then b else x"
not a "if a then b and c"
-
May 16th, 2002, 02:37 PM
#6
PowerPoster
-
May 17th, 2002, 08:14 AM
#7
Thread Starter
Hyperactive Member
not a problem,
a wrong solution is not a bad idea, just another solution that shows what doesn't work
-
May 24th, 2002, 08:15 AM
#8
I think the only thing you can do to speed this up is getting a better compiler.
Maybe this is a little bit faster:
instead of
Code:
row[0] = HWCLK32BIT;
row[1] = SWCLK32BIT;
row[2] = eventID;
row[3] = buffer;
do
Code:
*row = HWCLK32BIT;
++row;
*row = SWCLK32BIT;
++row;
*row = eventID;
++row;
*row = buffer;
But you'd have to check that. The 386 supports direct indexing which is supposed to be very fast, but you can never be sure.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|