How To Tune or Test PLSQL Code Performance in Oracle D2k Forms

You can test or tune your program unit performance in Oracle forms with Ora_Prof package.

Suppose you have created to procedure to perform a single task with different logic and you want to check exactly which procedure is performing well. See the below example:

declare
  i PLS_INTEGER;
BEGIN
    --test 1
  Ora_Prof.Create_Timer('test1');
  Ora_Prof.Start_Timer('test1');



  yourprogramunitwithsomelogic;

  Ora_Prof.Stop_Timer('test1');
  message('Test 1 Time taken '||Ora_Prof.Elapsed_Time('test1'), acknowledge);
  Ora_Prof.Destroy_Timer('test1');
  -- test 2
  Ora_Prof.Create_Timer('test2');
  Ora_Prof.Start_Timer('test2');

   yourprogramunitwithanotherlogic;

  Ora_Prof.Stop_Timer('test2');
  message('Test 2 Time taken '||Ora_Prof.Elapsed_Time('test2'),acknowledge);
  message('Test 2 Time taken '||Ora_Prof.Elapsed_Time('test2'),acknowledge);
  Ora_Prof.Destroy_Timer('test2');
END;

It will give the result in milliseconds and now you can analyze that which program is working good.

See also:

Creating, Stoping, Re-Starting timer in Oracle Forms

Tune Oracle Form's PLSQL Code with the help of timer


原文地址:https://www.cnblogs.com/quanweiru/p/6220091.html