Bug 167482 - Make the CLI for the sampling profiler better for inlined call site indices
Summary: Make the CLI for the sampling profiler better for inlined call site indices
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-26 18:25 PST by Saam Barati
Modified: 2017-01-27 17:05 PST (History)
14 users (show)

See Also:


Attachments
patch (17.75 KB, patch)
2017-01-27 13:07 PST, Saam Barati
mark.lam: review+
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews106 for mac-elcapitan-wk2 (1.00 MB, application/zip)
2017-01-27 14:21 PST, Build Bot
no flags Details
Archive of layout-test-results from ews103 for mac-elcapitan (883.83 KB, application/zip)
2017-01-27 14:24 PST, Build Bot
no flags Details
Archive of layout-test-results from ews113 for mac-elcapitan (1.61 MB, application/zip)
2017-01-27 14:30 PST, Build Bot
no flags Details
patch for landing (17.85 KB, patch)
2017-01-27 15:02 PST, Saam Barati
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2017-01-26 18:25:48 PST
I've been wanting to do this for a while, and I really need it for some performance debugging I'm doing, so I might as well get something landed into ToT.
Comment 1 Saam Barati 2017-01-27 13:07:35 PST
Created attachment 299954 [details]
patch
Comment 2 Saam Barati 2017-01-27 13:08:10 PST
New output:
```
Sampling rate: 1000 microseconds
Top functions as <numSamples  'functionName:sourceID'>
   128    'findGraphNode:2'
   119    'findGraphNode:3'
    32    'load:-1'
     9    '(program):1'
     5    'splice:-1'
     4    'search:3'
     3    'init:3'
     2    'GraphNode:1'
     2    'neighbors:3'
     1    'push:-1'
     1    'init:2'
     1    'neighbors:2'


Sampling rate: 1000 microseconds
Hottest bytecodes as <numSamples   'functionName#hash:JITType:bytecodeIndex'>
    97    'findGraphNode#EBmwVP:Baseline:33 <-- search#DTtNtq:FTL:407'
    93    'findGraphNode#EBmwVP:Baseline:55 <-- search#DTtNtq:FTL:407'
    32    'load#<nil>:None:<nil>'
    20    'findGraphNode#EBmwVP:Baseline:27 <-- search#DTtNtq:FTL:407'
    18    'findGraphNode#EBmwVP:Baseline:27 <-- search#DTtNtq:DFG:407'
     6    'findGraphNode#EBmwVP:Baseline:33 <-- search#DTtNtq:DFG:407'
     5    'splice#<nil>:None:<nil>'
     4    'findGraphNode#EBmwVP:Baseline:68 <-- search#DTtNtq:DFG:407'
     4    'init#Ct2Vq3:Baseline:45'
     3    'findGraphNode#EBmwVP:Baseline:66 <-- search#DTtNtq:DFG:407'
     2    '(program)#BS1Qqp:Baseline:311123'
     2    'findGraphNode#EBmwVP:Baseline:51 <-- search#DTtNtq:DFG:407'
     2    'findGraphNode#EBmwVP:DFG:27'
     1    'search#DTtNtq:FTL:177'
     1    'findGraphNode#EBmwVP:Baseline:55 <-- search#DTtNtq:FTL:475'
     1    '(program)#BS1Qqp:Baseline:310955'
     1    'neighbors#CZggLo:Baseline:0'
     1    'neighbors#CZggLo:DFG:0'
     1    'search#DTtNtq:Baseline:109'
     1    '(program)#BS1Qqp:Baseline:193614'
     1    '(program)#BS1Qqp:Baseline:127359'
     1    'GraphNode#BmXric:DFG:9'
     1    '(program)#BS1Qqp:Baseline:260298'
     1    'GraphNode#BmXric:Baseline:1'
     1    'search#DTtNtq:DFG:385'
     1    '(program)#BS1Qqp:Baseline:61835'
     1    '(program)#BS1Qqp:Baseline:310878'
     1    'search#DTtNtq:Baseline:140'
     1    'search#DTtNtq:Baseline:297'
     1    '(program)#BS1Qqp:Baseline:310982'
     1    'findGraphNode#EBmwVP:FTL:33'
     1    'push#<nil>:None:<nil>'
     1    'neighbors#CZggLo:DFG:52'
```



Old output:
```
Sampling rate: 1000 microseconds
Hottest functions as <numSamples  'functionName:sourceID'>
   117    'findGraphNode:2'
   114    'findGraphNode:3'
    29    'load:-1'
    12    '(program):1'
     6    'neighbors:2'
     4    'init:3'
     2    'splice:-1'
     2    'GraphNode:1'
     2    'search:3'
     2    'search:2'
     1    '(program):2'
     1    'init:2'
     1    'removeGraphNode:3'
     1    'neighbors:3'


Sampling rate: 1000 microseconds
Hottest bytecodes as <numSamples   'functionName#hash:JITType:bytecodeIndex'>
   112    'findGraphNode#EBmwVP:Baseline:33'
    64    'findGraphNode#EBmwVP:Baseline:55'
    35    'findGraphNode#EBmwVP:Baseline:27'
    29    'load#<nil>:None:<nil>'
     6    'findGraphNode#EBmwVP:Baseline:42'
     5    '(program)#BS1Qqp:Baseline:310855'
     4    'findGraphNode#EBmwVP:Baseline:66'
     3    'findGraphNode#EBmwVP:Baseline:68'
     3    'init#Ct2Vq3:Baseline:45'
     3    'findGraphNode#EBmwVP:Baseline:26'
     2    'splice#<nil>:None:<nil>'
     2    'neighbors#CZggLo:DFG:20'
     2    'neighbors#CZggLo:Baseline:1'
     1    'neighbors#CZggLo:DFG:280'
     1    '(program)#BS1Qqp:Baseline:310886'
     1    'GraphNode#BmXric:DFG:44'
     1    '(program)#BS1Qqp:Baseline:288234'
     1    'findGraphNode#EBmwVP:DFG:81'
     1    'neighbors#CZggLo:Baseline:151'
     1    'search#DTtNtq:Baseline:110'
     1    'findGraphNode#EBmwVP:DFG:27'
     1    'GraphNode#BmXric:DFG:84'
     1    'neighbors#CZggLo:Baseline:202'
     1    'search#DTtNtq:FTL:116'
     1    'search#DTtNtq:FTL:110'
     1    'init#Ct2Vq3:Baseline:100'
     1    '(program)#BS1Qqp:Baseline:311021'
     1    '(program)#AnfNV6:LLInt:237'
     1    'findGraphNode#EBmwVP:DFG:42'
     1    'findGraphNode#EBmwVP:DFG:26'
     1    '(program)#BS1Qqp:Baseline:87198'
     1    '(program)#BS1Qqp:Baseline:141719'
     1    'init#Ct2Vq3:Baseline:109'
     1    '(program)#BS1Qqp:Baseline:25997'
     1    '(program)#BS1Qqp:Baseline:219366'
     1    'removeGraphNode#DqCfaQ:Baseline:33'
     1    'search#DTtNtq:Baseline:286'
```
Comment 3 Mark Lam 2017-01-27 13:23:51 PST
Comment on attachment 299954 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=299954&action=review

LGTM

> Source/JavaScriptCore/runtime/SamplingProfiler.cpp:462
> +                StackFrame::CodeLocation machineLocation;
> +                populateCodeLocation(machineCodeBlock, machineOrigin.bytecodeIndex, machineLocation);

Is this already computed when we called appendCodeBlock() in origin.walkUpInlineStack()?  If so, can we just grab the machineLocation from stackTrace?
Comment 4 Mark Lam 2017-01-27 13:29:48 PST
Comment on attachment 299954 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=299954&action=review

>> Source/JavaScriptCore/runtime/SamplingProfiler.cpp:462
>> +                populateCodeLocation(machineCodeBlock, machineOrigin.bytecodeIndex, machineLocation);
> 
> Is this already computed when we called appendCodeBlock() in origin.walkUpInlineStack()?  If so, can we just grab the machineLocation from stackTrace?

Looks like you should just be able to get it from stackTrace.frames.last().semanticLocation since the last one is always for the machineCodeBlock.
Comment 5 Build Bot 2017-01-27 14:21:04 PST
Comment on attachment 299954 [details]
patch

Attachment 299954 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/2959924

New failing tests:
inspector/sampling-profiler/expression-location-info.html
Comment 6 Build Bot 2017-01-27 14:21:08 PST
Created attachment 299959 [details]
Archive of layout-test-results from ews106 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 7 Build Bot 2017-01-27 14:24:12 PST
Comment on attachment 299954 [details]
patch

Attachment 299954 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/2959944

New failing tests:
inspector/sampling-profiler/expression-location-info.html
Comment 8 Build Bot 2017-01-27 14:24:16 PST
Created attachment 299960 [details]
Archive of layout-test-results from ews103 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 9 Build Bot 2017-01-27 14:30:37 PST
Comment on attachment 299954 [details]
patch

Attachment 299954 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/2959947

New failing tests:
inspector/sampling-profiler/expression-location-info.html
Comment 10 Build Bot 2017-01-27 14:30:41 PST
Created attachment 299961 [details]
Archive of layout-test-results from ews113 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews113  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 11 Saam Barati 2017-01-27 14:54:00 PST
Comment on attachment 299954 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=299954&action=review

>>> Source/JavaScriptCore/runtime/SamplingProfiler.cpp:462
>>> +                populateCodeLocation(machineCodeBlock, machineOrigin.bytecodeIndex, machineLocation);
>> 
>> Is this already computed when we called appendCodeBlock() in origin.walkUpInlineStack()?  If so, can we just grab the machineLocation from stackTrace?
> 
> Looks like you should just be able to get it from stackTrace.frames.last().semanticLocation since the last one is always for the machineCodeBlock.

Yeah, good call. Will fix.

> Source/JavaScriptCore/runtime/SamplingProfiler.h:113
> +        bool lineNumber() const

lol at bool and C's type system. This is the bug causing inspector failure.
Comment 12 Saam Barati 2017-01-27 15:02:20 PST
Created attachment 299966 [details]
patch for landing
Comment 13 WebKit Commit Bot 2017-01-27 17:05:27 PST
Comment on attachment 299966 [details]
patch for landing

Clearing flags on attachment: 299966

Committed r211316: <http://trac.webkit.org/changeset/211316>
Comment 14 WebKit Commit Bot 2017-01-27 17:05:32 PST
All reviewed patches have been landed.  Closing bug.