Giter Site home page Giter Site logo

Comments (10)

rocallahan avatar rocallahan commented on August 28, 2024

It's easy to collect counts of the number of syscalls by reading the rr trace files, especially for non-wrapped syscalls which are recorded in ASCII.

from rr.

joneschrisg avatar joneschrisg commented on August 28, 2024
  • futex

As a note for posterity, glibc directly invokes futex; there's no unresolved symbol we can preload on top of. So we can't buffer it with our current approach. Shame.

from rr.

rocallahan avatar rocallahan commented on August 28, 2024

Any idea which symbols/how many symbols we'd need to override via LD_PRELOAD to catch most futex traffic?

from rr.

joneschrisg avatar joneschrisg commented on August 28, 2024

I would guess that pthread_mutex_{lock, unlock} and cond_wait would get us the vast vast majority. Doing that is a little scary and nontrivial though. But it's relatively easy to quantify how worth doing it would be once we have the structure in place.

from rr.

joneschrisg avatar joneschrisg commented on August 28, 2024

There are two measures that are interesting here: first is raw syscall count, which is easy to measure. The second is syscalls that "break the chain". For example, if gettimeofday is one of the top syscalls, we should buffer it, but if 1/3 of the time it's followed by stat say, then the buffering won't be as effective. We'd want to buffer stat too.

from rr.

joneschrisg avatar joneschrisg commented on August 28, 2024

On a small representative Firefox workflow, histogram-trace says the top 10 are

syscall count
------- -----
  78    145704  (gettimeofday)
 265    128062  (clock_gettime)
 240     31596  (futex)
 102     28834  (socketcall)
 168     19642  (poll)
   3     18464  (read)
 219      9700  (madvise???)
   4      7446  (write)
 221      7016  (fcntl64)
   5      6694  (open)
...

This pretty much matches historical data. Unfortunately futex and socketcall are giant pains in the butt to support, but looks like we'll want to. The rest are trivial though.

from rr.

joneschrisg avatar joneschrisg commented on August 28, 2024

219 9700 (madvise???)

This seems to be coming from a *Monkey [1] JIT. So not so surprising.

[1] I just realized I don't know what monkey FF is on anymore! sniffle

from rr.

joneschrisg avatar joneschrisg commented on August 28, 2024

The desched event, which was working so well in early testing, ain't doing so well with FF. I added wrappers for the easy syscalls above (futex, socketcall, and fcntl are hard), and FF blows up. However, when I was able to get a run that avoided the landmines, FF recorded about 10% faster just from wrapping poll (loading the start page). That's good news.

The wrapper for open also doesn't seem to be working all the time. rr ends up processing a significant number of open syscalls, even though we do sometimes hit the open wrapper, and the buffer isn't full. Needs investigation. However, even without wrapping all the open calls, FF is about 5% faster with the wrapper. That's also great news.

from rr.

joneschrisg avatar joneschrisg commented on August 28, 2024

The desched event turned out to still be working just fine, only a recent commit regressed it embarrassingly. I guess that's what happens when effectively dead code is committed. The basic syscalls above, sans poll too now, are working. Just needs some cleanup before commit. poll is proving to be a bit of a pain, and the work here is starting to pile up, so splitting that out into a followup.

from rr.

joneschrisg avatar joneschrisg commented on August 28, 2024

Testing shows that close and writev might be worth buffering. The latter is used by xlib, IIRC.

from rr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.