Closed Bug 987297 Opened 10 years ago Closed 10 years ago

Improve memory usage of profiler by packing ProfileEntry structs together better

Categories

(Core :: Gecko Profiler, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: vikstrous, Assigned: vikstrous)

Details

Attachments

(1 file, 1 obsolete file)

As mentioned in bug 962262, we can reduce profiler memory usage significantly (37% on 32 bit and 44% on 64 bit) by not wasting space in the circular buffer of of ProfileEntry structs.
We have 2 ideas to pack the structs better.

1. Use #pragma pack and let the compiler deal with unaligned access

2. Group the structs in groups of 8 so that we combine the char tag names into one 8 byte blob followed by 8 data blobs of 4 or 8 bytes (depending on platform).

Option 1 is *much* simpler to implement.
Jeff suggest:
3. We can make the ring buffer a binary buffer and do a manual memcpy in and out and have that work in bytes. It's not that hard to implement and it should only require modification to the circular buffer code (read, write) and nothing else outside.

This may be the best way to go rather then fight with #pragma features that may cause a lot of headaches.
Assignee: nobody → vstanchev
Attached patch memory_pack (obsolete) — Splinter Review
https://tbpl.mozilla.org/?tree=Try&rev=64dc7862407f

I also tested on B2G on a hamachi and the tags were 9 bytes.
Attachment #8398520 - Flags: review?(bgirard)
Attachment #8398520 - Flags: review?(bgirard) → review+
Flags: needinfo?(bgirard)
Attachment #8398520 - Attachment is obsolete: true
Flags: needinfo?(bgirard)
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/0219a7db2289
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
The following changeset is now in Firefox Nightly:

> 0219a7db2289 Bug 987297 - Improve memory usage of profiler by packing ProfileEntry structs together better. r=bgirard

Nightly Build Information:

        ID: 20140402030201
 Changeset: 4941a2ac0786109b08856738019b016a6c5a66a6
   Version: 31.0a1
      TBPL: https://tbpl.mozilla.org/?rev=4941a2ac0786
       URL: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central

Download Links:

>         Linux x86: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.linux-i686.tar.bz2
>      Linux x86_64: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.linux-x86_64.tar.bz2
> Linux x86_64 ASAN: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.linux-x86_64-asan.tar.bz2
>               Mac: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.mac.dmg
>             Win32: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.win32.installer.exe
>             Win64: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.win64-x86_64.installer.exe

Previous Nightly Build Information:

        ID: 20140401030203
 Changeset: 1417d180a1d8665b1a91b897d1cc4cc31e7980d4
   Version: 31.0a1
      TBPL: https://tbpl.mozilla.org/?rev=1417d180a1d8
       URL: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-01-03-02-03-mozilla-central
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: