Git Product home page Git Product logo

Comments (2)

yabinc avatar yabinc commented on August 22, 2024

Yes, it works as intended. You can use simpleperf dump to dump a perf.data, and check symbols from multiple dsos in FEAT_FILE2 section.

from ndk.

mstange avatar mstange commented on August 22, 2024

Oh indeed, it does work! The code is just a bit confusing - it looks as if it's trying to write multiple different feature sections, but instead it's all concatenated into one single big feature section.

But after writing each of them, it updates the section offset + size of the FEAT_FILE2 feature to point to the last-written section.

No, it only updates the size. RecordFileWriter::WriteFeatureBegin leaves the offset untouched if the feature already exists in RecordFileWriter::features_.
RecordFileWriter::WriteFeatureEnd updates the size.

So really, I was confused by the repeated calls to WriteFeatureBegin and WriteFeatureEnd. It would be clearer if there was only one call to each of them total, rather than one call per DSO. Repeated calls to WriteFeatureBegin are no-ops, and repeated calls to WriteFeatureEnd overwrite the previous call's effects.

RecordFileReader::LoadBuildIdAndFileFeatures appears to try to read multiple file feature sections. But the offset + size for each section is obtained from feature_section_descriptors_.find(FEAT_FILE2)->second, which will return the same values every time.

That's correct, but the read_pos will be the relative offset to the start of the section, and when RecordFileReader::ReadFileFeature returns, only the data for one DSO has been read, so read_pos will now point partway into the section, to the beginning of the data for the next DSO. So read_pos is different for each call to RecordFileReader::ReadFileFeature. Only once the data for all DSOs has been read will read_pos be equal to desc.size.

Again, what's confusing here is that there are multiple calls to RecordFileReader::ReadFileFeature, even though all calls are reading bytes from the same feature section. And the feature section descriptor is obtained repeatedly on each call even though it's always the same.

from ndk.

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.