Find waitevents in database - oracle database script

Find waitevents in database - Oracle Database Script

SELECT a.sid,
       substr(b.username, 1, 10) username,
       substr(b.osuser, 1, 10) osuser,
       substr(b.program||b.module, 1, 15) program,
       substr(b.machine, 1, 22) machine,
       a.event,
       a.p1,
       b.sql_hash_value
FROM v$session_wait a,
     V$session b
WHERE b.sid=a.sid
  AND a.event NOT IN('SQL*Net message from client',
                     'SQL*Net message to client',
                     'smon timer',
                     'pmon timer')
  AND username IS NOT NULL
ORDER BY 6 /