You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A-networkC-assignedThere is someone working on resolving the issueC-has-open-prThere is a PR open that resolves the issueE-more-complexVariable effort required; may require a mentor. Recommended solution is clearly described in the issI-perf-bloatUnnecessary memory usage.
add a new IpcReceiver argument to ResourceChannelManager::start that is used for listening to messages from the memory profiler (it must correspond with this sender)
Run Servo with ./mach run --memory-profile 5 to print a memory profile every 5 seconds. If these changes are successful, there should be a new entry for the network cache.
Compiling net v0.0.1 (file:///home/olmanz/Schreibtisch/workspaces/Rust/servo/components/net)
error: cannot find derive macro `MallocSizeOf` in this scope
--> components/net/http_cache.rs:93:10
|
93 | #[derive(MallocSizeOf)]
| ^^^^^^^^^^^^
error: aborting due to previous error
error: Could not compile `net`.
To learn more, run the command again with --verbose.
Build FAILED in 0:00:08
I already found out that there is a MallocSizeOf in the crate malloc_size_of. But when I import it with
#[macro_use] extern crate malloc_size_of;
use malloc_size_of::MallocSizeOf;
it says
Compiling net v0.0.1 (file:///home/olmanz/Schreibtisch/workspaces/Rust/servo/components/net)
error[E0463]: can't find crate for `mallo_size_of`
--> components/net/http_cache.rs:10:14
|
10 | #[macro_use] extern crate mallo_size_of;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
error: aborting due to previous error
error: Could not compile `net`.
To learn more, run the command again with --verbose.
Build FAILED in 0:00:08
add a new IpcReceiver argument to ResourceChannelManager::start that is used for listening to messages from the memory profiler (it must correspond with this sender)
The sender is a IpcSender<ReporterRequest>, so the new argument must be of type IpcReceiver<ReporterRequest> if I understand correctly?
use run_with_memory_reporting in the network code to register a memory reporter for that thread
I see that run_with_memory_reporting must be called on profiler_chan here, but the function also takes some arguments (reporter_name, channel_for_reporter and msg), and I currently don't know where to get them inside the thread.
@jdm
I'm still struggling with that part: use run_with_memory_reporting in the network code to register a memory reporter for that thread
I searched for other instances where run_with_memory_reporting is used, e.g. in components/script/script_thread.rs and components/layout_thread/lib.rs.
As I understand it, I have to call the function on profiler_chan in components/net/resource_thread.rs.
But I'm not quite sure about the where to get the parameters that function should take. Can you give me a tip?
the closure that will be executed - this is just the code that already exists, but turned into a closure
the reporter name - something like "network-cache-reporter"
a channel that will be used by the profiler thread to communicate with this code - I recommend creating a new channel, making ResourceChannelManager::start listen to the receiver, and passing the sender as this argument
a constructor for the message that will be sent on the channel - if the channel is only used for reporting, it should be enough to pass || () (which will provide a closure that returns a () value, meaning that the channel will only send and receive () values)
I'm passing || () now as recommended, but I get this error message now:
Compiling net v0.0.1 (file:///home/olmanz/Schreibtisch/workspaces/Rust/servo/components/net)
error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
--> components/net/resource_thread.rs:88:27
|
88 | mem_profiler_chan.run_with_memory_reporting(|| {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure that takes 1 argument
...
91 | }, reporter_name, chan.0, || ());
| -- takes 0 arguments
error: aborting due to previous error
error: Could not compile `net`.
To learn more, run the command again with --verbose.
Build FAILED in 0:00:10
Do you have a suggestion what I can do to fix this error?
@jdm Yeah! I'm trying to work to understand as much as possible. I refered to @olmanz branch and I understood the following changes have been implemented by him
Make HttpCache derive MallocSizeOf
-- Include malloc_size_of and malloc_size_of_derive in Cargo.toml file
-- Make CacheKey derive MallocSizeOf. Hence implement it for CacheKey, CacheResource, CacheResourceData
use run_with_memory_reporting in the network code to register a memory reporter for that thread
-- For which there is addition of mem::ProfileChan in argument list of new_resource_threads()
-- Include this in all occurences of new_resource_threads() and new_resource_thread()
[Current] add a new IpcReceiver argument to ResourceChannelManager::start that is used for listening to messages from the memory profiler (it must correspond with this sender)
-- Added IpcReceiver in the argument list and also assert its id inside the loop
I'm kinda getting errors at mem_profile_chan.run_with_memory_reporting(....)
I know its easier to just ask you, but I'm new to Rust as a whole, so am trying to understand what exactly is happening 😓 So sorry that I'm taking too much time on this, if I don't get it done by this weekend, will definitely ask you 😃
@jdm I did! I have the memory reporter displaying messages when running with --memory-profile At the moment, I'm slowly making the memory cache derive MallocSizeOf!
A-networkC-assignedThere is someone working on resolving the issueC-has-open-prThere is a PR open that resolves the issueE-more-complexVariable effort required; may require a mentor. Recommended solution is clearly described in the issI-perf-bloatUnnecessary memory usage.
Activity
jdm commentedon Nov 21, 2017
Required work:
jdm commentedon Nov 21, 2017
Run Servo with
./mach run --memory-profile 5to print a memory profile every 5 seconds. If these changes are successful, there should be a new entry for the network cache.olmanz commentedon Nov 22, 2017
I would want to try this.
jdm commentedon Nov 22, 2017
Great! Please ask questions if anything is unclear.
olmanz commentedon Nov 23, 2017
After changing
to
I get this error message during the build:
I already found out that there is a MallocSizeOf in the crate malloc_size_of. But when I import it with
it says
What am I missing here?
jdm commentedon Nov 23, 2017
For one thing, that error message says
mallo_size_of. However, be sure to add the crate to the Cargo.toml, as well.olmanz commentedon Nov 24, 2017
The sender is a
IpcSender<ReporterRequest>, so the new argument must be of typeIpcReceiver<ReporterRequest>if I understand correctly?I see that run_with_memory_reporting must be called on profiler_chan here, but the function also takes some arguments (reporter_name, channel_for_reporter and msg), and I currently don't know where to get them inside the thread.
olmanz commentedon Nov 28, 2017
@jdm
I'm still struggling with that part:
use run_with_memory_reporting in the network code to register a memory reporter for that threadI searched for other instances where run_with_memory_reporting is used, e.g. in components/script/script_thread.rs and components/layout_thread/lib.rs.
As I understand it, I have to call the function on profiler_chan in components/net/resource_thread.rs.
But I'm not quite sure about the where to get the parameters that function should take. Can you give me a tip?
jdm commentedon Nov 28, 2017
The other parameters are:
|| ()(which will provide a closure that returns a () value, meaning that the channel will only send and receive () values)olmanz commentedon Dec 5, 2017
@jdm
I changed the code block
to this:
I'm passing
|| ()now as recommended, but I get this error message now:Do you have a suggestion what I can do to fix this error?
jdm commentedon Dec 5, 2017
Oh, you can use
|_| ()to pass a closure that ignores the argument.10 remaining items
jdm commentedon Feb 14, 2018
@pandusonu2 Are you still working on this? Have you made any progress?
pandusonu2 commentedon Feb 15, 2018
@jdm Yeah! I'm trying to work to understand as much as possible. I refered to @olmanz branch and I understood the following changes have been implemented by him
-- Include malloc_size_of and malloc_size_of_derive in Cargo.toml file
-- Make CacheKey derive MallocSizeOf. Hence implement it for CacheKey, CacheResource, CacheResourceData
-- For which there is addition of mem::ProfileChan in argument list of new_resource_threads()
-- Include this in all occurences of new_resource_threads() and new_resource_thread()
-- Added IpcReceiver in the argument list and also assert its id inside the loop
I'm kinda getting errors at mem_profile_chan.run_with_memory_reporting(....)
I know its easier to just ask you, but I'm new to Rust as a whole, so am trying to understand what exactly is happening 😓 So sorry that I'm taking too much time on this, if I don't get it done by this weekend, will definitely ask you 😃
modal17 commentedon Feb 18, 2018
Heyo,
Although I am not assigned, is it possible for me to look into this too?
modal17 commentedon Feb 20, 2018
@pandusonu2 Are you working on this? Is it okay if I give it an attempt? @jdm
jdm commentedon Mar 5, 2018
@modal17 Did you delete a question that you previously asked? I swear I remember seeing one about what to measure.
modal17 commentedon Mar 9, 2018
@jdm I did! I have the memory reporter displaying messages when running with
--memory-profileAt the moment, I'm slowly making the memory cache derive MallocSizeOf!Measure cache memory usage (servo#19251):
Auto merge of #20391 - modal17:iss19251, r=jdm
Measure cache memory usage (servo#19251):
Auto merge of #20391 - modal17:iss19251, r=jdm
Measure cache memory usage (servo#19251):
Auto merge of #20391 - modal17:iss19251, r=jdm
Measure cache memory usage (servo#19251):