Re: Serial Port CPU Usage Problem



Eli,

Before answering you I would like you to compile and execute test
application that is attached with this post. Does this application also
consumes a lot of CPU time on your machine?

P.S. It uses simple ReadFile/WriteFile to read/write from/to file.

--
Vladimir

<eglaser@xxxxxxxxx> wrote in message
news:1151883388.691038.220190@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Vladimir,

Thank you for your comment. Do you have any suggestions on how to
reduce CPU usage or am I simply out of luck? It seems to me that
serial port communications should require minimal CPU time, but maybe
it is more complicated that I think.

Thanks,

Eli

Scherbina Vladimir wrote:
IMHO combining several read/writes into more compicated but single
transaction does not solve the problem and even one call to (Serial Port)
ReadFile/WriteFile in a cycle will consume the same CPU time.

The problem is not in the switch 'user mode/kernel mode' - a little test
with CreateFile on a file located at HDD, ReadFile/WriteFile illustrates
that when working with file these switches does not consume so much CPU.
I
think the problem is in the implementation of Serial Port protocol.

--
Vladimir



begin 666 test.cpp
M(VEN8VQU9&4@(G-T9&%F>"YH(@T*(VEN8VQU9&4@/'=I;F1O=W,N:#X-"@T*
M:6YT(%]T;6%I;BAI;G0@87)G8RP@7U1#2$%2*B!A<F=V6UTI#0I["0T*"4Q0
M5%-44B!S>D9I;&5.86UE(#T@3")(.EQ<6E@M-S$P+G!D9B([#0H-"@E(04Y$
M3$4@:$9I;&4@/2!#<F5A=&5&:6QE*'-Z1FEL94YA;64L($=%3D5224-?4D5!
M1'Q'14Y%4DE#7U=2251%+" P+"!.54Q,+"!/4$5.7T5825-424Y'+" P+" P
M*3L-"@T*"6EF("A)3E9!3$E$7TA!3D1,15]604Q512 A/2!H1FEL92D-"@E[
M#0H)"4173U)$(&1W4F5A9" @(#T@,#L-"@D)8VAA<B!S>D)U9C%;,UT@/2![
M3E5,3'T[#0H)"6-H87(@<WI"=68R6S%=(#T@>TY53$Q].PT*#0H)"7=H:6QE
M("AT<G5E*0T*"0E[#0H)"0EI9B H1D%,4T4@/3T@4F5A9$9I;&4@*&A&:6QE
M+"!S>D)U9C$L('-I>F5O9BAS>D)U9C$I+" F9'=296%D+"!.54Q,*2D-"@D)
M"0EB<F5A:SL-"@D)"6EF("A&04Q312 ]/2!296%D1FEL92 H:$9I;&4L('-Z
M0G5F,BP@<VEZ96]F*'-Z0G5F,BDL("9D=U)E860L($Y53$PI*0T*"0D)"6)R
M96%K.PT*"0D):68@*$9!3%-%(#T](%=R:71E1FEL92AH1FEL92P@<WI"=68R
M+"!S:7IE;V8H<WI"=68R*2P@)F1W4F5A9"P@3E5,3"DI#0H)"0D)8G)E86L[
M#0H)"0EE;'-E#0H)"0D)4VQE97 @*#,S*3L-"@D)?0T*#0H)"4-L;W-E2&%N
@9&QE*&A&:6QE*3L-"@E]#0H-"@ER971U<FX@,#L-"GT`
`
end

.



Relevant Pages

  • Re: Changing process priority
    ... How do I make sure a simple whileloop ... doesn't consume half my CPU? ... Though sometimes there is a "idle process" that runs ... an infinite loop consuming all leftover CPU time, ...
    (comp.lang.c)
  • Re: MSDN volatile sample
    ... A thread running in a tight loop with Sleepwill consume all remaining ... CPU time, AND won't let lower priority background threads to run. ... You mean Sleepwill consume 100% CPU time? ...
    (microsoft.public.vc.language)
  • Re: system idle process
    ... The "idle" process may not even consume much of your CPU time, ... might stop the processor until the next interrupt. ...
    (microsoft.public.win32.programmer.kernel)
  • slow system
    ... and "svchost.exe"(whose user name is NETWORK SERVICE) ... consume 100% of CPU time. ... delete them in the task manager? ...
    (microsoft.public.windowsxp.general)

Quantcast