Re: Cobol app takes 100% CPU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Manfred

Changing idle first parameter to 10 didn't help, but changing it to 1
or 2 slowed down the cobol app. I was changing e-mails with Bart
privatetly about that. The problem with this approach is that when the
app really needs the cpu, for generating reports, it also runs slow, I
guess because it keeps updating a number on the screen.

After some debugging I identified an AX pattern when the app is in the
menus, which is the main problem of this app, so I only slow down
dosemu when I detect this pattern:

--- ../dosemu-1.4.0/src/base/bios/int16.c       2007-05-04
    02:59:48.000000000 -0300
+++ src/base/bios/int16.c       2008-03-28 15:10:13.000000000 -0300
@@ -112,16 +112,22 @@
 
 static unsigned check_key_available(int extended)
 {
+  static int oldAX=0;
   unsigned keyptr = get_key(extended);
   if(keyptr == -1) {
     if(!port60_buffer || (port60_buffer & 0x80))
       trigger_idle();
     else
       reset_idle(0);
-    idle(500, 20, 0, INT2F_IDLE_USECS, "int16");
+/*     printf ("AX=%x\n",_AX); */
+    if (_AX == 0x1100 && oldAX==0x1103 ) /* here I detect the pattern */
+      idle(2, 20, 0, INT2F_IDLE_USECS, "int16");
+    else
+      idle(500, 20, 0, INT2F_IDLE_USECS, "int16");
   } else {
     reset_idle(1);
   }
+  oldAX = _AX;
   return get_key(extended);
 }

This is a sort of dirty solution, but it worked fine...

Thanks,
Rodrigo



Manfred Scherer <manfred.scherer.mhm@xxxxxxxxxxx> writes:

> Hi all,
> I have had the the same problem with other programs i.e. dbase 3+ word 4.0 ...
> in dosemu 1.3.4 I have made a small change in
> src/base/bios/int16.c  in function check_key_available():
>
> here is the code for dosemu 1.3.4, I think this is equal to 1.4.0:
>
> static unsigned check_key_available(int extended)
> {
>   unsigned keyptr = get_key(extended);
>   if(keyptr == -1) {
>     if(!port60_buffer || (port60_buffer & 0x80))
>       trigger_idle();
>     else
>       reset_idle(0);
>     /* 2006-12-13
>      * dbase3+, word4.0, .... CPU-load is to heavy during idle. --ms
>      * idle(500, 20, 0, INT2F_IDLE_USECS, "int16");
>      */
>     idle(10, 20, 0, INT2F_IDLE_USECS, "int16");
>   } else {
>     reset_idle(1);
>   }
>   return get_key(extended);
> }
>
> I think that may help for Cobol too.
>
> Manfred
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-msdos" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Console]     [Linux Audio]     [Linux for Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Camping]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Samba]     [Linux Media]     [Fedora Users]

  Powered by Linux