-
PL/Sql sleep for a few microseconds
I would like to code a pl/sql for loop which stresses my cpu approximately 5%.
Without sleep the cpu is fully stressed 100%.
So my sleep in the loop should be very small.
I only know these two Packages.
execute dbms_lock.sleep(0.05);
execute user_lock.sleep(5);
But their precision is 1/100 second so it doesn't fit my needs.
Does anyone know a alternative with a precision around microseconds?
-
SQL> begin
2 dbms_lock.sleep(1/10000) ;
3 end;
4 /
PL/SQL procedure successfully completed.
Tamil
www.oracleact.com
-
The problem is oracle cuts off all number after a precision of 1/100 so it doesn't matter what i enter.
ex. dbms_lock.sleep(0.0001) = dbms_lock.sleep(1/1000) = dbms_lock.sleep(0)
No errors are shown.
-
A dummy loop will help:
Code:
SQL> declare
2 J NUMBER;
3 begin
4 FOR J in 1..100 LOOP
5 NULL;
6 END LOOP;
7 end;
8 /
PL/SQL procedure successfully completed.
Tamil
www.oracleact.com
-
Yes that's true.
A loop in a loop until my 1/100 seconds are enough for a cpu load of 5%.
Thank you.
-
You should remember that PL/SQL is designed mainly to code business functionality.
You can't do to many tricky things with pl/sql. You can try Java instead.
Sridhar R Patnam
-
Wouldn't the dummy loop cause a delay only by using CPU cycles? I don't see it helping achieve the goal.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|