History log of /external/perfetto/src/ftrace_reader/cpu_reader.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
870dd82f0a1190b1890ca3e592f68bc5bbece627 18-May-2018 Florian Mayer <fmayer@google.com> Correctly handle EINTR.

This fixes a bug that made the CPU reader loop exit when the program
gets send SIGSTOP.

Cherry pick of http://aosp/689181.

Bug: 79969427
Merged-In: I09ae42adb5b211e0eae73364dcef1b4d33762ed8
Change-Id: I0f76ba9d3aba77a607175fc1f31ec7edcfa2afe6
/external/perfetto/src/ftrace_reader/cpu_reader.h
3cbb10a30c000fcd2cd4658dd215778422c7bbb1 10-Apr-2018 Primiano Tucci <primiano@google.com> Remove warning suppressions and fix many casting bugs

This change removes most warning suppressions, in particular
from production code. In the past we inherit a bunch of -Wno-xxx
suppressions required to build gtest and libprotobuf headers.
Doing so, however, caused the suppressions to propagate back to
the translation units that were including any protobuf header
or any auto-generated .pb.h stub.
This change moves the gtest and probobuf header to be a
system include (-isystem vs -I). Doing so implicitly blacklists
any compiler warning on the headers.
This CL then re-enables warnings and deals with the fall out of
fixes that came out of this.

Bug: 77316877
Test: pefetto_unittests / perfetto_integrationtests
Change-Id: I3a01852ebf7d0b9bf19658ddf117209d129c70be
/external/perfetto/src/ftrace_reader/cpu_reader.h
727d1cb433bf06f85a69312a5c3fc1610b7cb1b6 03-Apr-2018 Florian Mayer <fmayer@google.com> Remove dead code

Bug: 76169489
Change-Id: I8b41f27ff8e41fb90ead747c9d0aa6287d11b30a
/external/perfetto/src/ftrace_reader/cpu_reader.h
808d6df6d555faf56d2ad537d5b08dfaf3e72dd9 31-Mar-2018 Primiano Tucci <primiano@google.com> Support building most targets on mac

Rationale: takes very little efforts, increases unittest-ability and
avoid having to think/#ifdef when using the watchdog.

Bug: 76169489
Change-Id: Ife14e2ec77d21b17fa48a48f0629c4026a60bf2c
/external/perfetto/src/ftrace_reader/cpu_reader.h
b8e235b7ab322672c2646050fca0c6c7cf22cef4 22-Mar-2018 Florian Mayer <fmayer@google.com> Ignore traced_probe's own I/O activity.

Bug: 73947457
Change-Id: I15c24cccc20c5350196bbc10dbcd3617bea6aaae
/external/perfetto/src/ftrace_reader/cpu_reader.h
2c3ac7fd218a9de6e842a68338750447be369c76 22-Mar-2018 Hector Dearman <hjd@google.com> ftrace_reader: Adjust DCHECK on Inode collection

In theory each ftrace inode is preceded by an block device id, this
adds a DCHECK to test this.

Bug: 73873362
Change-Id: Ifb7ab9845a6ae1490e9b94da4259e51ca74cb7ce
/external/perfetto/src/ftrace_reader/cpu_reader.h
cd3b6d37da21315216af2044bf4f34d57882f74c 20-Mar-2018 Hector Dearman <hjd@google.com> traced_probes: Add data_source_types.h

We need a place to put types that src/ftrace_reader, src/traced/probes,
and, future producer impls (e.g. src/memory) can all depend on.
include/perfetto/traced is the pragmatic place to avoid intoducing an
extra build target.

Bug: 73625480
Change-Id: I8a053411a81d3d3d877e0a7325e89fd524aa373f
/external/perfetto/src/ftrace_reader/cpu_reader.h
8ce30879c9384dfb870d7496fdff62e2e0f5db50 19-Mar-2018 Anna Zappone <azappone@google.com> ftrace_reader: Update for uint64 block device ids

Switch previous code for plumbing uint32 device ids to translate to uint64 and add
translation strategies for uint64 device ids.
Add static_casts for inode numbers as well.

Bug: 73873362
Bug: 73625480
Change-Id: Id76ef4759739e78994c7b5bd2a9f85dc7d0890e3
/external/perfetto/src/ftrace_reader/cpu_reader.h
ba3eeaeb6068b9426d891041b0ab1c827bd63d02 12-Mar-2018 Florian Mayer <fmayer@google.com> Make relative includes absolute.

Change-Id: I9d3eeb67d6b39b05dd85d11746497791ac2665f9
/external/perfetto/src/ftrace_reader/cpu_reader.h
4ea73c08d0f22519a9b959adc9c41b351f494da6 09-Mar-2018 Anna Zappone <azappone@google.com> ftrace_reader: Plumb block_device_ids via metadata

Add the block device id with each inode number to metadata.
Use the stored device id in probes_producer to ensure duplicate
inode numbers are matched correctly.
All our current format files have had dev id and then inode immediately after.
When an inode number is seen, get the most recent dev id and add the pair
to metadata.

Bug: 73873362
Bug: 73625480
Change-Id: I1eeae21a840bbfa1be5cda95bd7a0010706c8e31
/external/perfetto/src/ftrace_reader/cpu_reader.h
22e4b396fcfd44ef7f70c5f2ecb8f665eee97742 08-Mar-2018 Florian Mayer <fmayer@google.com> Run clang-tidy.

Change-Id: I4b173963d14a627daf319427ba2752fca482ada4
/external/perfetto/src/ftrace_reader/cpu_reader.h
f19e7c57e810e39f28f25921a6e7f7630ec3c7b1 06-Mar-2018 Hector Dearman <hjd@google.com> ftrace_reader: Plumb pids via metadata

Change-Id: I6731ee57d1b20d86700dce97653d0425d51c00c8
/external/perfetto/src/ftrace_reader/cpu_reader.h
c8488034fcc8ff2fc09c4991c2b997f4702ee1cc 02-Mar-2018 Hector Dearman <hjd@google.com> ftrace_reader: Plumb metadata from CpuReader

We want to neatly communicate some information (such as
inode and pids) seen in the raw ftrace buffer to
ProbesProducer where it can be used to gather aditional
information on the inode/process.

This CL plumbs an additional argument (FtraceMetadata)
into the OnBundleComplete callback. FtraceMetadata is a
container for 'out-of-band' information about the
events in the bundle. For now this is just the number
of overwritten events and the set of observed inodes.

On the ProbesProducer side we wire this argument up to a
log statement.

Change-Id: I05d38c2db7f7f75a320f86de24182cc2bc3e6821
/external/perfetto/src/ftrace_reader/cpu_reader.h
1f14b621554e89efe0294dbdd83d7e6ac823790c 27-Feb-2018 Hector Dearman <hjd@google.com> ftrace_reader: Plumb overwrite from page header

The ftrace page header includes a field named "overwrite" which is in some way
related to the number of events overwritten. This plumbs that value to the
FtraceProtoBundle proto. Specifically we add a new field 'overwrite' which is the
total of all overwrite fields from the headers of all kernel ftrace pages we parsed
into this FtraceEventBundle. The value is zero if no overwriting occurred, a number
larger than zero if some overwriting occurred.

While we are here we also:
- Set cpu only once per ftrace_bundle.
- Remove cpu parameter from ParsePage.
- Add metadata out parameter to ParsePage for overwrite, inodes, pids of interest etc.

Bug: 72045210
Change-Id: I985ff880c88101317a2120b43d420fcd8272b113
/external/perfetto/src/ftrace_reader/cpu_reader.h
5a407c12d527440998c4c22ab490bfe6ab5a178a 22-Feb-2018 Anna Zappone <azappone@google.com> ftrace_reader: Add initial inode to filename code

Add inode to filename mapping by walking through filesystem and saving filenames that match inode numbers from events.

Bug: 73625480
Change-Id: I2decec1f18eefee45f3b8d624c69263d2750b59d
/external/perfetto/src/ftrace_reader/cpu_reader.h
e1e56b63c369ffe22dc30fb2eeaac1556266d3ec 21-Feb-2018 Hector Dearman <hjd@google.com> protozero: Remove protozero from the name of files

Second part of:
https://android-review.googlesource.com/c/platform/external/perfetto/+/606697

Script:
mv ./src/protozero/protozero_message_unittest.cc ./src/protozero/message_unittest.cc
mv ./src/protozero/protozero_message.cc ./src/protozero/message.cc
mv ./src/protozero/protozero_message_handle.cc ./src/protozero/message_handle.cc
mv ./src/protozero/protozero_message_handle_unittest.cc ./src/protozero/message_handle_unittest.cc
mv ./include/perfetto/protozero/protozero_message.h ./include/perfetto/protozero/message.h
mv ./include/perfetto/protozero/protozero_message_handle.h ./include/perfetto/protozero/message_handle.h
find . -type f -name '*.h' | grep -v buildtools | grep -v out | while read f; do sed -i 's/protozero_message\.h/message\.h/g' $f; done
find . -type f -name '*.h' | grep -v buildtools | grep -v out | while read f; do sed -i 's/protozero_message_handle\.h/message_handle\.h/g' $f; done
find . -type f -name '*.cc' | grep -v buildtools | grep -v out | while read f; do sed -i 's/protozero_message\.h/message\.h/g' $f; done
find . -type f -name '*.cc' | grep -v buildtools | grep -v out | while read f; do sed -i 's/protozero_message_handle\.h/message_handle\.h/g' $f; done
find . -type f -name '*.gn' | grep -v buildtools | grep -v out | while read f; do sed -i 's/protozero_message/message/g' $f; done
find . -type f -name '*.gn' | grep -v buildtools | grep -v out | while read f; do sed -i 's/protozero_message_handle/message_handle/g' $f; done

Bug: 70386249
Change-Id: Ifdeda80db539070ec2f07466de32f855a7cc85cc
/external/perfetto/src/ftrace_reader/cpu_reader.h
aaa4c1997f110dee086ee93b83bfc7ac11bfc102 19-Feb-2018 Hector Dearman <hjd@google.com> Rename protozero::ProtozeroX -> protozero::X

Commands:
find . -type f -name '*.cc' | grep -v buildtools | grep -v out | while read f; do sed -i 's/ProtoZeroMessage/Message/g' $f; done
find . -type f -name '*.h' | grep -v buildtools | grep -v out | while read f; do sed -i 's/ProtoZeroMessage/Message/g' $f; done
find . -type f -name '*.cc' | grep -v buildtools | grep -v out | while read f; do sed -i 's/ProtoZeroMessageHandle/MessageHandle/g' $f; done
find . -type f -name '*.h' | grep -v buildtools | grep -v out | while read f; do sed -i 's/ProtoZeroMessageHandle/MessageHandle/g' $f; done

Bug: 70386249
Change-Id: Iec8ef0e67a522a7b8988ce788bc63ba2775422fc
/external/perfetto/src/ftrace_reader/cpu_reader.h
74b1f2ac0ad97dd0470d17cc2d220875f739f3e1 16-Feb-2018 Anna Zappone <azappone@google.com> Save inode numbers in cpu_reader to get inode to filename mappings

Change-Id: Ic6b38010871fb1b6f126f0176105528dbc939a3f
/external/perfetto/src/ftrace_reader/cpu_reader.h
247110bb9e52876f0412ece815c81ca055a3a898 14-Feb-2018 Sami Kyostila <skyostil@google.com> Improve ftrace scheduling

This patch implements the following ftrace scheduling algorithm:


main thread [drain] [unblock]
/: |
post .-----' : |
/ : v
worker #0 [splice ...] [wakeup] [block ............] [splice]
:
worker #1 [splice ...] [wakeup] [block ........] [splice]
:
worker #2 [splice ..........................................]
:
:
drain period (100ms)

In other words, the splice(2) system call is used to move data from
the raw kernel ftrace pipe into an intermediate pipe at a page
granularity. This call allows every per-cpu worker to sleep until there
is at least one page of data available.

When a worker wakes up, it will attempt to move as many pages as
possible to its staging pipe (up to 64K, depending on the
system's pipe buffer size) in a non-blocking way. After this, it
will notify the main thread that data is available. This notification
will block the calling worker until the main thread has drained the
data.

When at least one worker has woken up, we schedule a drain operation
on the main thread for the next drain period (every 100ms by default).
The drain operation parses ftrace data from the staging pipes of
every worker having pending data. After this, each waiting worker is
allowed to issue another call to splice(), restarting the cycle.

Change-Id: I9657a5d50cd936f190bc57f2c9778019cb7419ab
/external/perfetto/src/ftrace_reader/cpu_reader.h
680a28b924d212f5e05136a2ea1bdd77ea87e8de 11-Jan-2018 Hector Dearman <hjd@google.com> ftrace_reader: Backport reading raw pipes on timer

- Backport the changes from the demo to read the raw pipe on a timer
rather than when there is data in the pipe.
- Fix case where if we disable/enable quickly we end up with two
periodic tasks for each CPU.
- Add tests.

Change-Id: I482c12323c78495a072c568f3b63f33acfe179ed
/external/perfetto/src/ftrace_reader/cpu_reader.h
77af1339a9fb654ed0e54c12c0448073e54d3279 15-Dec-2017 Hector Dearman <hjd@google.com> ftrace_reader: Add dynamic parser (part 4)

In part the forth we:
- Refactor common fields to use the new generic parsing method.
- Rename Char16 to FixedCString and make it work on strings of
any length.
- Extract the field merging logic.

Bug: 70328826
Change-Id: I116ac4c98d07fe7be7ba458c0524c3bab07bba87
/external/perfetto/src/ftrace_reader/cpu_reader.h
2ddcc7b1f5203ff60f71f761e33e1f7adee2aa9f 13-Dec-2017 Hector Dearman <hjd@google.com> ftrace_reader: Add dynamic parser (part 3)

In the latest installment of this CL we:
- Add a new 'joint' enum with all valid combinations of ftrace and
proto types.
- Keep track of the total size of each event at parse time allowing
us to make only one bounds check per event.
- Modify cpu_reader to use these two new features.
- Add a new unit test to cover the increasingly complicated
ProtoTranslationTableUnittest::Create method.

Bug: 70328826
Change-Id: Ice4c110253ef94d2516762566c32b1e46b988803
/external/perfetto/src/ftrace_reader/cpu_reader.h
cc6dcb0c65320bcbfef60507e2352ec8da53adc7 12-Dec-2017 Hector Dearman <hjd@google.com> ftrace_reader: Add dynamic parser (part 2)

Rather than handcoding a parser for each event use the
ProtoTranslationTable to dynamically read each field of the event.

Bug: 70328826
Change-Id: I154904c7e805f281706e21c0f0aef0bb2936926d
/external/perfetto/src/ftrace_reader/cpu_reader.h
6fd5e5cd38e334e3bb6e63afb116be19c9aa4a79 06-Dec-2017 Hector Dearman <hjd@google.com> Remove size argument from ParsePage

The kernel always gives us a full page when reading trace_pipe_raw.
We shouldn't pretend the code will work in the untested case where
we get less than a full page especially since that will probably
just hide a deeper problem if the kernel starts giving us less
than a page.

Change-Id: I2a8793aaadb3717c04b13fa5d9b0db19bc11ff7c
/external/perfetto/src/ftrace_reader/cpu_reader.h
5add654e12ebc80bd28c707fe25bf814987b6f38 06-Dec-2017 Hector Dearman <hjd@google.com> Improve CpuReader unittests

It's too painful and error prone to construct the binary format by hand
for tests. Instead we should record real examples then compare the result of
parsing them to golden protos. This does the first part allowing us to
include a representation of the binary data in the test file.

Also add minimal set of format files for testing with when we don't want
to load several hundred files.

Change-Id: Ic75d4bca6b12107e2d4df814eb912da259044f0c
/external/perfetto/src/ftrace_reader/cpu_reader.h
4f9b6d7b7b2ad7b86e1577a18dc6e2df91b98164 05-Dec-2017 Primiano Tucci <primiano@google.com> Pivot source files into top-level src,include and unify test target

See discussion in go/perfetto-build-files .
This is to disambiguate things like
#include "base/logging.h"
when in the chrome tree.

Also this CL unifies the test targets into two monolithic targets:
perfetto_tests and perfetto_benchmarks. This is to avoid ending
up with confusing binary names in the chrome tree (e.g.,
ipc_unittests)

Bug: 68710794
Change-Id: I1768e15b661406052b2be060d7aab0f1e7443a98
/external/perfetto/src/ftrace_reader/cpu_reader.h