2 * Copyright (C) 2015 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 static void CheckMmapRecordDataEqual(const MmapRecord& r1, const MmapRecord& r2) {
18 ASSERT_EQ(0, memcmp(&r1.data, &r2.data, sizeof(r1.data)));
19 ASSERT_EQ(r1.filename, r2.filename);
22 static void CheckCommRecordDataEqual(const CommRecord& r1, const CommRecord& r2) {
23 ASSERT_EQ(0, memcmp(&r1.data, &r2.data, sizeof(r1.data)));
24 ASSERT_EQ(r1.comm, r2.comm);
27 static void CheckRecordEqual(const Record& r1, const Record& r2) {
28 ASSERT_EQ(0, memcmp(&r1.header, &r2.header, sizeof(r1.header)));
29 ASSERT_EQ(0, memcmp(&r1.sample_id, &r2.sample_id, sizeof(r1.sample_id)));
30 if (r1.header.type == PERF_RECORD_MMAP) {
31 CheckMmapRecordDataEqual(static_cast<const MmapRecord&>(r1), static_cast<const MmapRecord&>(r2));
32 } else if (r1.header.type == PERF_RECORD_COMM) {
33 CheckCommRecordDataEqual(static_cast<const CommRecord&>(r1), static_cast<const CommRecord&>(r2));