This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 207950

Summary: com.sun.jna.Function.invokeVoid[native] counted as running CPU
Product: profiler Reporter: David Strupl <dstrupl>
Component: BaseAssignee: issues@profiler <issues>
Status: REOPENED ---    
Severity: normal    
Priority: P3    
Version: 7.2   
Hardware: PC   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:

Description David Strupl 2012-01-31 13:04:42 UTC
The JNA invocation is counted as if the CPU was used by the thread. In the case of calling some method which is blocked (like in the following thread in NetBeans:


 "Thread-5" - Thread t@32
    java.lang.Thread.State: RUNNABLE
	at com.sun.jna.Function.invokeVoid(Native Method)
	at com.sun.jna.Function.invoke(Function.java:328)
	at com.sun.jna.Function.invoke(Function.java:276)
	at com.sun.jna.Library$Handler.invoke(Library.java:216)
	at $Proxy6.CFRunLoopRun(Unknown Source)
	at org.netbeans.modules.masterfs.watcher.macosx.OSXNotifier$1.run(OSXNotifier.java:126)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:680)

) it might be marked as non-using the CPU not to confuse the users.
Comment 1 J Bachorik 2012-05-22 13:25:08 UTC
Do you propose to count all native invocations as blocking ones? 

The trouble is that you can not tell for sure whether a native call is blocking or not ...
Comment 2 David Strupl 2012-05-22 13:59:59 UTC
Not all. Only the "well" known ones. At least for NetBeans there are just 2 of them: one on MacOSX (as shown on the stack trace org.netbeans.modules.masterfs.watcher.macosx.OSXNotifier$1.run. The other one would be on Windows.