Bug 198466 - [WinCairo] Implement cpu and memory measuring functions.
Summary: [WinCairo] Implement cpu and memory measuring functions.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-06-02 03:57 PDT by Takashi Komori
Modified: 2019-06-04 12:16 PDT (History)
6 users (show)

See Also:


Attachments
Patch (14.23 KB, patch)
2019-06-02 04:17 PDT, Takashi Komori
no flags Details | Formatted Diff | Diff
Patch (14.08 KB, patch)
2019-06-03 18:26 PDT, Takashi Komori
no flags Details | Formatted Diff | Diff
Patch (14.05 KB, patch)
2019-06-03 18:33 PDT, Takashi Komori
no flags Details | Formatted Diff | Diff
Patch (14.52 KB, patch)
2019-06-04 00:31 PDT, Takashi Komori
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews122 for ios-simulator-wk2 (2.52 MB, application/zip)
2019-06-04 02:27 PDT, EWS Watchlist
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Takashi Komori 2019-06-02 03:57:15 PDT
On WinCairo layout tests related to inspector doesn't work at all.
This is because lack of CPUProfilerObserver and MemoryObserver which are used in Test.js. (Source/WebInspectorUI/UserInterface/Test/Test.js)

In This ticket we aim to fix it by enabling ENABLE_RESOURCE_USAGE.
Comment 1 Takashi Komori 2019-06-02 04:17:30 PDT
Created attachment 371142 [details]
Patch
Comment 2 Fujii Hironori 2019-06-02 21:25:24 PDT
Comment on attachment 371142 [details]
Patch

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

> Source/WebCore/PlatformWinCairo.cmake:16
> +    page/win/ResourceUsageThreadWinCairo.cpp

Rename *Win.cpp.

> Source/WebCore/page/win/ResourceUsageThreadWinCairo.cpp:43
> +uint64_t fileTimeToUint64(FILETIME ft)

Mark these file-local functions "static".

> Tools/WebKitTestRunner/InjectedBundle/win/TestRunnerWin.cpp:-40
> -    return JSStringCreateWithUTF8CString("");

What about using UrlCreateFromPath?
https://docs.microsoft.com/en-us/windows/desktop/api/shlwapi/nf-shlwapi-urlcreatefrompatha

> Tools/WebKitTestRunner/InjectedBundle/win/TestRunnerWin.cpp:44
> +        _wsplitpath(exePath, drive, dir, nullptr, nullptr);

Why do you need to split first?

> Tools/WebKitTestRunner/InjectedBundle/win/TestRunnerWin.cpp:52
> +        char stubPathUTF8[MAX_PATH];

MAX_PATH shouldn't be used for UTF-8 buffer length. How about using JSStringCreateWithCharacters? Then, you don't need to convert to UTF-8.

> LayoutTests/platform/wincairo/TestExpectations:1566
>  inspector [ Skip ]

Can you unskip all inspector tests? How much failure will occur? If you can't unskip inspector tests, I think you should change the summary of this bug.
Comment 3 Don Olmstead 2019-06-03 18:23:50 PDT
Comment on attachment 371142 [details]
Patch

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

> Source/WebCore/page/win/ResourceUsageOverlayWinCairo.cpp:30
> +#if ENABLE(RESOURCE_USAGE) && OS(WINDOWS)

You shouldn't need any of these OS checks.

> Source/WebCore/page/win/ResourceUsageThreadWinCairo.cpp:31
> +#if ENABLE(RESOURCE_USAGE) && OS(WINDOWS)

Ditto
Comment 4 Takashi Komori 2019-06-03 18:26:01 PDT
Created attachment 371236 [details]
Patch
Comment 5 Takashi Komori 2019-06-03 18:33:49 PDT
Created attachment 371237 [details]
Patch
Comment 6 Takashi Komori 2019-06-03 18:47:50 PDT
(In reply to Fujii Hironori from comment #2)
> Comment on attachment 371142 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=371142&action=review
> 
> > Source/WebCore/PlatformWinCairo.cmake:16
> > +    page/win/ResourceUsageThreadWinCairo.cpp
> 
> Rename *Win.cpp.

Renamed.

> > Source/WebCore/page/win/ResourceUsageThreadWinCairo.cpp:43
> > +uint64_t fileTimeToUint64(FILETIME ft)
> 
> Mark these file-local functions "static".

Marked.

> > Tools/WebKitTestRunner/InjectedBundle/win/TestRunnerWin.cpp:-40
> > -    return JSStringCreateWithUTF8CString("");
> 
> What about using UrlCreateFromPath?
> https://docs.microsoft.com/en-us/windows/desktop/api/shlwapi/nf-shlwapi-
> urlcreatefrompatha

Changed to use UrlCreateFromPathW.
 
> > Tools/WebKitTestRunner/InjectedBundle/win/TestRunnerWin.cpp:44
> > +        _wsplitpath(exePath, drive, dir, nullptr, nullptr);
> 
> Why do you need to split first?

We need to determine resource directory path.
This part makes the path by splitting absolute path of WebKitTestRunner.exe.

> > Tools/WebKitTestRunner/InjectedBundle/win/TestRunnerWin.cpp:52
> > +        char stubPathUTF8[MAX_PATH];
> 
> MAX_PATH shouldn't be used for UTF-8 buffer length. How about using
> JSStringCreateWithCharacters? Then, you don't need to convert to UTF-8.

Changed.

> > LayoutTests/platform/wincairo/TestExpectations:1566
> >  inspector [ Skip ]
> 
> Can you unskip all inspector tests? How much failure will occur? If you
> can't unskip inspector tests, I think you should change the summary of this
> bug.

Changed.
Comment 7 Takashi Komori 2019-06-03 18:48:36 PDT
(In reply to Don Olmstead from comment #3)
> Comment on attachment 371142 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=371142&action=review
> 
> > Source/WebCore/page/win/ResourceUsageOverlayWinCairo.cpp:30
> > +#if ENABLE(RESOURCE_USAGE) && OS(WINDOWS)
> 
> You shouldn't need any of these OS checks.
> 
> > Source/WebCore/page/win/ResourceUsageThreadWinCairo.cpp:31
> > +#if ENABLE(RESOURCE_USAGE) && OS(WINDOWS)
> 
> Ditto

Fixed.
Comment 8 Don Olmstead 2019-06-03 19:13:12 PDT
Comment on attachment 371237 [details]
Patch

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

Couple nits but LGTM overall. Fujii could you take another pass?

> Source/WebCore/page/win/ResourceUsageThreadWin.cpp:116
> +    // FIXME: Exclude the ResourceUsage thread.
> +    // FIXME: Exclude the SamplingProfiler thread.
> +    // FIXME: Classify usage per thread.
> +    data.cpuExcludingDebuggerThreads = data.cpu;

Could you open up a bug for this work and then link to it?

> Source/cmake/OptionsWinCairo.cmake:35
> +set(ENABLE_RESOURCE_USAGE ON)

This is a WebKit option so this should be moved to OptionsWin.cmake in the `if (${WTF_PLATFORM_WIN_CAIRO})` block in between WEBKIT_OPTION_BEGIN() and WEBKIT_OPTION_END()

```
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE OFF)
```
Comment 9 Don Olmstead 2019-06-03 19:14:07 PDT
(In reply to Don Olmstead from comment #8)
> Comment on attachment 371237 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=371237&action=review
> > Source/cmake/OptionsWinCairo.cmake:35
> > +set(ENABLE_RESOURCE_USAGE ON)
> 
> This is a WebKit option so this should be moved to OptionsWin.cmake in the
> `if (${WTF_PLATFORM_WIN_CAIRO})` block in between WEBKIT_OPTION_BEGIN() and
> WEBKIT_OPTION_END()
> 
> ```
> WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE OFF)
> ```

Sorry ON not OFF. Copy paste error...
Comment 10 Don Olmstead 2019-06-03 19:15:23 PDT
(In reply to Don Olmstead from comment #9)
> (In reply to Don Olmstead from comment #8)
> > Comment on attachment 371237 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=371237&action=review
> > > Source/cmake/OptionsWinCairo.cmake:35
> > > +set(ENABLE_RESOURCE_USAGE ON)
> > 
> > This is a WebKit option so this should be moved to OptionsWin.cmake in the
> > `if (${WTF_PLATFORM_WIN_CAIRO})` block in between WEBKIT_OPTION_BEGIN() and
> > WEBKIT_OPTION_END()
> > 
> > ```
> > WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE OFF)
> > ```
> 
> Sorry ON not OFF. Copy paste error...

Actually can you add it to the experimental features list till we have the full implementation.

WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
Comment 11 Don Olmstead 2019-06-03 22:02:18 PDT
Comment on attachment 371237 [details]
Patch

r=me

Fix the CMake part and this is good to go
Comment 12 Takashi Komori 2019-06-04 00:31:37 PDT
Created attachment 371252 [details]
Patch
Comment 13 Takashi Komori 2019-06-04 00:49:52 PDT
(In reply to Don Olmstead from comment #10)
> (In reply to Don Olmstead from comment #9)
> > (In reply to Don Olmstead from comment #8)
> > > Comment on attachment 371237 [details]
> > > Patch
> > > 
> > > View in context:
> > > https://bugs.webkit.org/attachment.cgi?id=371237&action=review
> > > > Source/cmake/OptionsWinCairo.cmake:35
> > > > +set(ENABLE_RESOURCE_USAGE ON)
> > > 
> > > This is a WebKit option so this should be moved to OptionsWin.cmake in the
> > > `if (${WTF_PLATFORM_WIN_CAIRO})` block in between WEBKIT_OPTION_BEGIN() and
> > > WEBKIT_OPTION_END()
> > > 
> > > ```
> > > WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE OFF)
> > > ```
> > 
> > Sorry ON not OFF. Copy paste error...
> 
> Actually can you add it to the experimental features list till we have the
> full implementation.
> 
> WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE
> ${ENABLE_EXPERIMENTAL_FEATURES})

FIXED.
Comment 14 Takashi Komori 2019-06-04 01:26:44 PDT
(In reply to Don Olmstead from comment #8)
> Comment on attachment 371237 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=371237&action=review
> 
> Couple nits but LGTM overall. Fujii could you take another pass?
> 
> > Source/WebCore/page/win/ResourceUsageThreadWin.cpp:116
> > +    // FIXME: Exclude the ResourceUsage thread.
> > +    // FIXME: Exclude the SamplingProfiler thread.
> > +    // FIXME: Classify usage per thread.
> > +    data.cpuExcludingDebuggerThreads = data.cpu;
> 
> Could you open up a bug for this work and then link to it?
> 

Opened https://bugs.webkit.org/show_bug.cgi?id=198519
Comment 15 EWS Watchlist 2019-06-04 02:27:29 PDT
Comment on attachment 371252 [details]
Patch

Attachment 371252 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/12370788

New failing tests:
http/wpt/service-workers/service-worker-networkprocess-crash.html
Comment 16 EWS Watchlist 2019-06-04 02:27:31 PDT
Created attachment 371257 [details]
Archive of layout-test-results from ews122 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-wk2  Platform: Mac OS X 10.14.5
Comment 17 WebKit Commit Bot 2019-06-04 12:15:27 PDT
Comment on attachment 371252 [details]
Patch

Clearing flags on attachment: 371252

Committed r246076: <https://trac.webkit.org/changeset/246076>
Comment 18 WebKit Commit Bot 2019-06-04 12:15:29 PDT
All reviewed patches have been landed.  Closing bug.
Comment 19 Radar WebKit Bug Importer 2019-06-04 12:16:21 PDT
<rdar://problem/51409011>