diff options
author | Yabin Cui <yabinc@google.com> | 2015-05-04 20:27:57 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2015-05-05 14:23:10 -0700 |
commit | 7d59bb49fb47fbc82ef5c77d7aebf7174fd996e1 (patch) | |
tree | 8c090275f1d8f88edb80b8f7746751256e1538ba /simpleperf/record_equal_test.h | |
parent | 1352b82d4aed6b5dd64cffaa2aefec0cfd45aeaa (diff) | |
download | extras-7d59bb49fb47fbc82ef5c77d7aebf7174fd996e1.tar.gz |
Dump kernel/modules/thread mmap information in `simpleperf record`.
Bug: 19483574
Change-Id: Ia65cb12804a6dffa440501736a6229b2f7248958
Diffstat (limited to 'simpleperf/record_equal_test.h')
-rw-r--r-- | simpleperf/record_equal_test.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/simpleperf/record_equal_test.h b/simpleperf/record_equal_test.h new file mode 100644 index 00000000..45b0752c --- /dev/null +++ b/simpleperf/record_equal_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +static void CheckMmapRecordDataEqual(const MmapRecord& r1, const MmapRecord& r2) { + ASSERT_EQ(0, memcmp(&r1.data, &r2.data, sizeof(r1.data))); + ASSERT_EQ(r1.filename, r2.filename); +} + +static void CheckCommRecordDataEqual(const CommRecord& r1, const CommRecord& r2) { + ASSERT_EQ(0, memcmp(&r1.data, &r2.data, sizeof(r1.data))); + ASSERT_EQ(r1.comm, r2.comm); +} + +static void CheckRecordEqual(const Record& r1, const Record& r2) { + ASSERT_EQ(0, memcmp(&r1.header, &r2.header, sizeof(r1.header))); + ASSERT_EQ(0, memcmp(&r1.sample_id, &r2.sample_id, sizeof(r1.sample_id))); + if (r1.header.type == PERF_RECORD_MMAP) { + CheckMmapRecordDataEqual(static_cast<const MmapRecord&>(r1), static_cast<const MmapRecord&>(r2)); + } else if (r1.header.type == PERF_RECORD_COMM) { + CheckCommRecordDataEqual(static_cast<const CommRecord&>(r1), static_cast<const CommRecord&>(r2)); + } +} |