home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / emerald / emrldsys.lha / Kernel / Em / measure.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-17  |  10.0 KB  |  252 lines

  1.  
  2. /*  C O P Y R I G H T   N O T I C E :                                     */
  3. /* Copyright 1986 Eric Jul and Norm Hutchinson.     May not be used for any  */
  4. /* purpose without written permission from the authors.              */
  5.  
  6. /* Contains the measurement instrumentation and counters                  */
  7.  
  8. #include "Kernel/h/stdTypes.h"
  9. #include "Kernel/h/kmdTypes.h"
  10.  
  11. int             cEM_directCreates               = 0;
  12. int             cEM_totalInvokes                = 0;
  13. int             cEM_directInvokes               = 0;
  14. int             cEM_inlinedInvokes              = 0;
  15. int             cEM_localInvokes                = 0;
  16. int             cEM_selfInvokes                 = 0;
  17. int             cEM_KCTimmutableInvokes         = 0;
  18. int             cEM_UKCTimmutableInvokes        = 0;
  19. int             cEM_KCTresidentGlobalInvokes    = 0;
  20. int             cEM_UKCTresidentGlobalInvokes   = 0;
  21.  
  22. int        cINVK_RemoteInvokes        = 0;     /* invoke.c */
  23. int        cINVK_RemoteReturns        = 0;    /* invoke.c */
  24. int        cINVK_RemoteNoSuccessReturns    = 0;    /* invoke.c */
  25. int        cINVK_InvokeFaults        = 0;    /* invoke.c */
  26. int        cINVK_RemoteInvokesBytesSent    = 0;    /* invoke.c */
  27. int        cINVK_RemoteInvokesPacketsSent  = 0;
  28. int        cINVK_RemoteReturnsBytesSent    = 0;    /* invoke.c */
  29. int        cINVK_RemoteReturnsPacketsSent  = 0;
  30.  
  31. int        cMV_MovesDone            = 0;    /* mobility.c */
  32. int        cINVK_CallByMovesDone        = 0;    /* invoke.c */
  33. int        cINVK_CallByResultMovesDone    = 0;
  34. int        cINVK_CallByVisitsDone        = 0;    /* invoke.c */
  35. int        cINVK_CallByVisitReturnsDone    = 0;    /* invoke.c */
  36. int        cMV_MovesBytesSent        = 0;    /* mobility.c */
  37. int        cMV_MovesPacketsSent        = 0;
  38. int        cINVK_CallByMovesBytesSent    = 0;    /* invoke.c */
  39. int        cINVK_CallByResultBytesSent    = 0;
  40. int        cINVK_CallByVisitsBytesSent    = 0;    /* invoke.c */
  41. int        cINVK_CallByVisitReturnBytesSent= 0;    /* invoke.c */
  42.  
  43. int             cCP_CheckpointsDone             = 0;    /* checkPoint.c */
  44. int             cCP_CheckpointsBytesSent        = 0;    /* checkPoint.c */
  45.  
  46. int        cLOC_LocatesDone        = 0;    /* locate.c */
  47. int        cLOC_ShoutsSent            = 0;    /* locate.c */
  48. int        cLOC_ShoutBroadcastsSent    = 0;    /* locate.c */
  49. int        cLOC_SearchsSent        = 0;    /* locate.c */
  50. int        cLOC_SearchBroadcastsSent    = 0;    /* locate.c */
  51. int        cLOC_SearchProdsSent        = 0;    /* locate.c */
  52.  
  53. int             cEM_moves                = 0;
  54. int             cEM_fixes            = 0;
  55. int             cEM_unfixes            = 0;
  56. int             cEM_refixes            = 0;
  57. int             cEM_locates            = 0;
  58. int             cEM_callByMoves                = 0;
  59. int             cEM_callByResultMoves            = 0;
  60. int             cEM_callByVisits            = 0;
  61.  
  62.  
  63. /* Snapshot */
  64. void EMDumpStats()
  65. {
  66.     KMDPrint("Dump of counters\n");
  67.     KMDPrint("%8d directCreates\n", cEM_directCreates);
  68.     KMDPrint("%8d totalInvokes\n", cEM_totalInvokes);
  69.     KMDPrint("%8d directInvokes\n", cEM_directInvokes);
  70.     KMDPrint("%8d inlinedInvokes\n", cEM_inlinedInvokes);
  71.     KMDPrint("%8d local invokes\n", cEM_localInvokes);
  72.     KMDPrint("%8d self invokes\n", cEM_selfInvokes);
  73.     KMDPrint("%8d KCT invokes of immutable objects\n",
  74.       cEM_KCTimmutableInvokes);
  75.     KMDPrint("%8d UKCT invokes of immutable objects\n",
  76.       cEM_UKCTimmutableInvokes);
  77.     KMDPrint("%8d KCT invokes of resident globals\n",
  78.       cEM_KCTresidentGlobalInvokes);
  79.     KMDPrint("%8d UKCT invokes of resident globals\n",
  80.       cEM_UKCTresidentGlobalInvokes);
  81.     KMDPrint("%8d Invoke Faults\n", cINVK_InvokeFaults);
  82.     KMDPrint("%8d Remote Invokes\n", cINVK_RemoteInvokes);
  83.     KMDPrint("%8d Remote Invokes Bytes Sent, avg. %8.2f\n",
  84.       cINVK_RemoteInvokesBytesSent, cINVK_RemoteInvokes > 0 ?
  85.       cINVK_RemoteInvokesBytesSent / (float) cINVK_RemoteInvokes : 0);
  86.     KMDPrint("%8d Remote Invokes Packets Sent, avg. %8.2f\n",
  87.       cINVK_RemoteInvokesPacketsSent, cINVK_RemoteInvokes > 0 ?
  88.       cINVK_RemoteInvokesPacketsSent / (float) cINVK_RemoteInvokes : 0);
  89.     KMDPrint("%8d Remote Returns\n", cINVK_RemoteReturns);
  90.     KMDPrint("%8d Remote Returns Bytes Sent, avg. %8.2f\n",
  91.       cINVK_RemoteReturnsBytesSent, cINVK_RemoteReturns > 0 ?
  92.       cINVK_RemoteReturnsBytesSent / (float) cINVK_RemoteReturns : 0);
  93.     KMDPrint("%8d Remote Returns Packets Sent, avg. %8.2f\n",
  94.       cINVK_RemoteReturnsPacketsSent, cINVK_RemoteReturns > 0 ?
  95.       cINVK_RemoteReturnsPacketsSent / (float) cINVK_RemoteReturns : 0);
  96.  
  97.     KMDPrint("%8d Move statements\n", cEM_moves);
  98.     KMDPrint("%8d Moves Actually Done\n", cMV_MovesDone);
  99.     KMDPrint("%8d Bytes moved, avg. %8.2f\n", cMV_MovesBytesSent,
  100.         cMV_MovesDone > 0 ? cMV_MovesBytesSent / (float) cMV_MovesDone : 0);
  101.     KMDPrint("%8d Packets for move, avg. %8.2f\n", cMV_MovesPacketsSent,
  102.         cMV_MovesDone > 0 ? cMV_MovesPacketsSent / (float) cMV_MovesDone : 0);
  103.     KMDPrint("%8d Fix statements\n", cEM_fixes);
  104.     KMDPrint("%8d Unfix statements\n", cEM_unfixes);
  105.     KMDPrint("%8d Refix statements\n", cEM_refixes);
  106.     KMDPrint("%8d Checkpoints done\n", cCP_CheckpointsDone);
  107.     KMDPrint("%8d Checkpoint bytes sent\n", cCP_CheckpointsBytesSent);
  108.     KMDPrint("%8d Locate expressions\n", cEM_locates);
  109.     KMDPrint("%8d Locates Done\n", cLOC_LocatesDone);
  110.     KMDPrint("%8d Shout  broadcasts sent with %4d requests, avg. %8.2f\n",
  111.       cLOC_ShoutBroadcastsSent, cLOC_ShoutsSent,
  112.       cLOC_ShoutBroadcastsSent > 0 ?
  113.       cLOC_ShoutsSent / (float) cLOC_ShoutBroadcastsSent : 0);
  114.     KMDPrint("%8d Search broadcasts sent with %4d requests, avg. %8.2f\n",
  115.       cLOC_SearchBroadcastsSent, cLOC_SearchsSent,
  116.       cLOC_SearchBroadcastsSent > 0 ?
  117.       cLOC_SearchsSent / (float) cLOC_SearchBroadcastsSent : 0);
  118.     KMDPrint("%8d Search Prods sent\n", cLOC_SearchProdsSent);
  119.     KMDPrint("%8d Call by move arguments\n", cEM_callByMoves);
  120.     KMDPrint("%8d Call by moves done\n", cINVK_CallByMovesDone);
  121.     KMDPrint("%8d Call by moves bytes sent, avg. %8.2f\n",
  122.       cINVK_CallByMovesBytesSent,
  123.       cINVK_CallByMovesDone > 0 ? cINVK_CallByMovesBytesSent /
  124.       (float) cINVK_CallByMovesDone : 0);
  125.     KMDPrint("%8d Call by move results\n", cEM_callByResultMoves);
  126.     KMDPrint("%8d Call by result moves done\n", cINVK_CallByResultMovesDone);
  127.     KMDPrint("%8d Call by result bytes sent, avg. %8.2f\n",
  128.       cINVK_CallByResultBytesSent,
  129.       cINVK_CallByResultMovesDone > 0 ? cINVK_CallByResultBytesSent /
  130.       (float) cINVK_CallByResultMovesDone : 0);
  131.     KMDPrint("%8d Call by visit arguments\n", cEM_callByVisits);
  132.     KMDPrint("%8d Call by visit moves done\n", cINVK_CallByVisitsDone);
  133.     KMDPrint("%8d Call by visit bytes sent, avg. %8.2f\n",
  134.       cINVK_CallByVisitsBytesSent,
  135.       cINVK_CallByVisitsDone > 0 ? cINVK_CallByVisitsBytesSent /
  136.       (float) cINVK_CallByVisitsDone : 0);
  137.     KMDPrint("%8d Call by visit return moves done\n",
  138.       cINVK_CallByVisitReturnsDone);
  139.     KMDPrint("%8d Call by visit returning bytes, avg. %8.2f\n",
  140.       cINVK_CallByVisitReturnBytesSent,
  141.       cINVK_CallByVisitReturnsDone > 0 ? cINVK_CallByVisitReturnBytesSent /
  142.       (float) cINVK_CallByVisitReturnsDone : 0);
  143.     
  144. }
  145.  
  146. /* Snapshot */
  147. void EMResetStats()
  148. {
  149.     KMDPrint("Counters reset\n");
  150.     cEM_directCreates               = 0;
  151.     cEM_totalInvokes                = 0;
  152.     cEM_directInvokes               = 0;
  153.     cEM_inlinedInvokes              = 0;
  154.     cEM_localInvokes                = 0;
  155.     cEM_selfInvokes                 = 0;
  156.     cEM_KCTimmutableInvokes         = 0;
  157.     cEM_UKCTimmutableInvokes        = 0;
  158.     cEM_KCTresidentGlobalInvokes    = 0;
  159.     cEM_UKCTresidentGlobalInvokes   = 0;
  160.  
  161.     cINVK_InvokeFaults            = 0;
  162.     cINVK_RemoteInvokes            = 0;
  163.     cINVK_RemoteReturns            = 0;
  164.     cINVK_RemoteInvokesBytesSent    = 0;
  165.     cINVK_RemoteReturnsBytesSent    = 0;
  166.     cINVK_RemoteInvokesPacketsSent  = 0;
  167.     cINVK_RemoteReturnsPacketsSent  = 0;
  168.  
  169.     cMV_MovesDone            = 0;
  170.     cMV_MovesPacketsSent        = 0;
  171.     
  172.     cINVK_CallByMovesDone        = 0;
  173.     cINVK_CallByResultMovesDone        = 0;
  174.     cINVK_CallByVisitsDone        = 0;
  175.     cINVK_CallByVisitReturnsDone    = 0;
  176.     cMV_MovesBytesSent            = 0;
  177.     cINVK_CallByMovesBytesSent        = 0;
  178.     cINVK_CallByResultBytesSent        = 0;
  179.     cINVK_CallByVisitsBytesSent        = 0;
  180.     cINVK_CallByVisitReturnBytesSent= 0;
  181.  
  182.     cLOC_LocatesDone            = 0;
  183.     cLOC_ShoutsSent            = 0;
  184.     cLOC_ShoutBroadcastsSent        = 0;
  185.     cLOC_SearchsSent            = 0;
  186.     cLOC_SearchBroadcastsSent        = 0;
  187.     cLOC_SearchProdsSent        = 0;
  188.  
  189.     cEM_moves                = 0;
  190.     cEM_fixes                = 0;
  191.     cEM_unfixes                = 0;
  192.     cEM_refixes                = 0;
  193.     cEM_locates                = 0;
  194.     cEM_callByMoves            = 0;
  195.     cEM_callByResultMoves        = 0;
  196.     cEM_callByVisits            = 0;
  197. }
  198.  
  199.  
  200. void MeasureInit()
  201. {
  202.     KMDSetSnap(EMDumpStats);
  203.     KMDSetSnap(EMResetStats);
  204.     KMDSetVar(cEM_directCreates);
  205.     KMDSetVar(cEM_totalInvokes);
  206.     KMDSetVar(cEM_directInvokes);
  207.     KMDSetVar(cEM_inlinedInvokes);
  208.     KMDSetVar(cEM_localInvokes);
  209.     KMDSetVar(cEM_selfInvokes);
  210.     KMDSetVar(cEM_KCTimmutableInvokes);
  211.     KMDSetVar(cEM_UKCTimmutableInvokes);
  212.     KMDSetVar(cEM_KCTresidentGlobalInvokes);
  213.     KMDSetVar(cEM_UKCTresidentGlobalInvokes);
  214.     KMDSetVar(cINVK_InvokeFaults);
  215.     KMDSetVar(cINVK_RemoteInvokes);
  216.     KMDSetVar(cINVK_RemoteReturns);
  217.     KMDSetVar(cINVK_RemoteInvokesBytesSent);
  218.     KMDSetVar(cINVK_RemoteReturnsBytesSent);
  219.     KMDSetVar(cINVK_RemoteInvokesPacketsSent);
  220.     KMDSetVar(cINVK_RemoteReturnsPacketsSent);
  221.  
  222.     KMDSetVar(cMV_MovesDone);
  223.     KMDSetVar(cMV_MovesPacketsSent);
  224.     
  225.     KMDSetVar(cINVK_CallByMovesDone);
  226.     KMDSetVar(cINVK_CallByResultMovesDone);
  227.     KMDSetVar(cINVK_CallByVisitsDone);
  228.     KMDSetVar(cINVK_CallByVisitReturnsDone);
  229.  
  230.     KMDSetVar(cMV_MovesBytesSent);
  231.     KMDSetVar(cINVK_CallByMovesBytesSent);
  232.     KMDSetVar(cINVK_CallByResultBytesSent);
  233.     KMDSetVar(cINVK_CallByVisitsBytesSent);
  234.     KMDSetVar(cINVK_CallByVisitReturnBytesSent);
  235.     
  236.     KMDSetVar(cLOC_LocatesDone);
  237.     KMDSetVar(cLOC_ShoutsSent);
  238.     KMDSetVar(cLOC_ShoutBroadcastsSent);
  239.     KMDSetVar(cLOC_SearchsSent);
  240.     KMDSetVar(cLOC_SearchBroadcastsSent);
  241.     KMDSetVar(cLOC_SearchProdsSent);
  242.     
  243.     KMDSetVar(cEM_moves);    
  244.     KMDSetVar(cEM_fixes);
  245.     KMDSetVar(cEM_unfixes);
  246.     KMDSetVar(cEM_refixes);
  247.     KMDSetVar(cEM_locates);
  248.     KMDSetVar(cEM_callByMoves);
  249.     KMDSetVar(cEM_callByResultMoves);
  250.     KMDSetVar(cEM_callByVisits);
  251. }
  252.