Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhauled allocations documentation for helpfulness #643

Merged
merged 12 commits into from
Jun 4, 2024

Conversation

RobinBateman808
Copy link
Collaborator

@RobinBateman808 RobinBateman808 commented Apr 18, 2024

Motivation:

Edited documentation to improve helpfulness for new and experienced Swift on Server (SOS) users.

Modifications:

Added definitions and explanations where needed, edited existing content for clarity, and formatted for scannability.

Result:

Increase user adoption and bolster the SOS community.

@kaishin
Copy link
Collaborator

kaishin commented Apr 21, 2024

@0xTim

Copy link
Collaborator

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! See comments

documentation/server/guides/allocations.md Outdated Show resolved Hide resolved
documentation/server/guides/allocations.md Outdated Show resolved Hide resolved
documentation/server/guides/allocations.md Outdated Show resolved Hide resolved
documentation/server/guides/allocations.md Outdated Show resolved Hide resolved
documentation/server/guides/allocations.md Outdated Show resolved Hide resolved
@RobinBateman808
Copy link
Collaborator Author

@0xTim - made changes as suggested and corrected code formatting.

Copy link
Collaborator

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there! Few last changes


```swift
An example program using AsyncHTTPClient can be written as:
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing language on the code block, re-add

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xTim - Thanks for the review. I'm not sure what's happening with the code. I'm not making any changes to the blocks or text unless it was something you previously caught. Any suggestions or insight would be appreciated. :-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted space before code blocks. Preview of text renders language in code block.
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the code block against the original. Looks the same.


```bash
In this instance, a user probe was installed for all allocation functions because Swift uses other functions like `calloc` and `posix_memalign`.
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing language in the code block

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted space before code blocks. The text renders as it should.
image


which should output something like
To confirm the user probe `probe_libc:malloc` works, run this command:
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```bash

documentation/server/guides/allocations.md Outdated Show resolved Hide resolved
```bash
### Creating flame graphs
Once you’ve successfully recorded data using `perf record`, you can invoke the following command to produce an SVG file with the flame graph:
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```bash

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hasn't been added?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, I missed this. Has been corrected and checked 2x.

On Apple platforms, Swift uses a slightly larger number of allocation functions than Linux. Therefore, specifying a few more functions is required.

Once the data is collected, run this command to create an SVG file:
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Language

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean here. But removed "Therefore, specifying a few more functions is required." to mitigate confusion.

perf script | \
/FlameGraph/stackcollapse-perf.pl - | \
swift demangle --simplified | \
/FlameGraph/flamegraph.pl --countname allocations \
--width 1600 > out.svg
--width 1600 > out.svg
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still missing the indentation

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added indent again. Hoping it "sticks" this time.

image

@RobinBateman808
Copy link
Collaborator Author

@0xTim - Hopefully, the latest changes will fix things. Thanks for your time and patience! :-)

@RobinBateman808
Copy link
Collaborator Author

Hi @0xTim - Friendly bump when you have a moment. :-)

Copy link
Collaborator

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorryfor the delay @RobinBateman808

For language I mean the language of the code in the code block. So if you start a clock of code with

```swift

That tells the site generator to add the language="swift" tag to the generated code block so the syntax highlighter can process the code block and show syntax highlighting. This appears to have been removed in many of the code blocks so we should add them back to make it easier to read. Some options are

```swift
```docker
```bash

```bash
### Creating flame graphs
Once you’ve successfully recorded data using `perf record`, you can invoke the following command to produce an SVG file with the flame graph:
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hasn't been added?

RobinBateman808 and others added 2 commits June 4, 2024 14:34
Co-authored-by: Tim Condon <[email protected]>
Copy link
Collaborator

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This looks good to go

There are a few existing code blocks for running commands that could be annotated with

```bash

But since they're existing it shouldn't hold up the PR (note that the output of the different commands shouldn't have a language applied) and can be done in a separate PR if desired

@0xTim
Copy link
Collaborator

0xTim commented Jun 4, 2024

@swift-ci test

@0xTim 0xTim enabled auto-merge (squash) June 4, 2024 21:05
@0xTim
Copy link
Collaborator

0xTim commented Jun 4, 2024

@swift-ci test

@0xTim 0xTim merged commit 864bfb9 into main Jun 4, 2024
1 check passed
@0xTim 0xTim deleted the robins-allocations-edits branch June 4, 2024 21:06
@RobinBateman808
Copy link
Collaborator Author

Thanks @0xTim! I'll create a new PR to remove the applied language for the outputs.

@0xTim
Copy link
Collaborator

0xTim commented Jun 4, 2024

@RobinBateman808 It's all good, there wasn't any applied languages and I added all the missing ones before merging as it was a quick fix

@RobinBateman808
Copy link
Collaborator Author

Ack. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants