Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

LWIP question regarding speed optimization

when fooling around with the performance counter inside the LWIP checksum routines, i discovered that in the LWIP_checksum routine, the actual making of the checksum is 10% of the load, the reaming 90% is cedited to the return stament at the end, totalling over 50000 clock cycles for returning a value...

does returning the value really take this long? i dont understand this, if this is correct then using HW to do the checksumming would give me less then 10% increase (i cant go from 15 clock cycles to 0 for the checksum operation after all, it will still be 5 cycles or so)

so where do those 50000 cycles go every checksum? when my webserver is outputting data then 100% of the cpu load is in the LWIP_Checksum routine, 10 on the calculations, 90 on the return

does anyone have a clue?

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by thomsonbro+oct 20 2005, 08:54 am--><div class='quotetop'>quote (thomsonbro @ oct 20 2005, 08:54 am)</div>

    --- quote start ---

    when fooling around with the performance counter inside the lwip checksum routines, i discovered that in the lwip_checksum routine, the actual making of the checksum is 10% of the load, the reaming 90% is cedited to the return stament at the end, totalling over 50000 clock cycles for returning a value...[/b]

    --- quote end ---

    wow. that does look funny, but i have to wonder if it&#39;s crediting loop-control time to that return statement, or more likely, if it&#39;s doing a lot of restore-calling-state-before-return work. or maybe you&#39;re getting interrupted there?

    <!--quotebegin-thomsonbro@Oct 20 2005, 08:54 AM

    does returning the value really take this long? i dont understand this, if this is correct then using hw to do the checksumming would give me less then 10% increase (i cant go from 15 clock cycles to 0 for the checksum operation after all, it will still be 5 cycles or so)

    --- Quote End ---

    Sounds like you just need to replace the whole function call with a custom instruction or macro...?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    to be honest i think your right, i think the performance counter is including the cpu time for the underlying routines that called the checksum routine to the return statement, i see no other way realy

    now to find out were all that stuff actually goes http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif