Matteo Martincigh | 0aed4f9 | 2019-10-01 14:25:34 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2019 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include <ProfilingUtils.hpp> |
| 7 | |
| 8 | #include <boost/test/unit_test.hpp> |
| 9 | #include <boost/numeric/conversion/cast.hpp> |
| 10 | |
| 11 | using namespace armnn::profiling; |
| 12 | |
| 13 | BOOST_AUTO_TEST_SUITE(TimelinePacketTests) |
| 14 | |
| 15 | BOOST_AUTO_TEST_CASE(TimelineLabelPacketTest1) |
| 16 | { |
| 17 | const uint64_t profilingGuid = 123456u; |
| 18 | const std::string label = "some label"; |
| 19 | unsigned int numberOfBytesWritten = 789u; |
| 20 | TimelinePacketStatus result = WriteTimelineLabelBinaryPacket(profilingGuid, |
| 21 | label, |
| 22 | nullptr, |
| 23 | 512u, |
| 24 | numberOfBytesWritten); |
| 25 | BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion); |
| 26 | BOOST_CHECK(numberOfBytesWritten == 0); |
| 27 | } |
| 28 | |
| 29 | BOOST_AUTO_TEST_CASE(TimelineLabelPacketTest2) |
| 30 | { |
| 31 | std::vector<unsigned char> buffer(512, 0); |
| 32 | |
| 33 | const uint64_t profilingGuid = 123456u; |
| 34 | const std::string label = "some label"; |
| 35 | unsigned int numberOfBytesWritten = 789u; |
| 36 | TimelinePacketStatus result = WriteTimelineLabelBinaryPacket(profilingGuid, |
| 37 | label, |
| 38 | buffer.data(), |
| 39 | 0, |
| 40 | numberOfBytesWritten); |
| 41 | BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion); |
| 42 | BOOST_CHECK(numberOfBytesWritten == 0); |
| 43 | } |
| 44 | |
| 45 | BOOST_AUTO_TEST_CASE(TimelineLabelPacketTest3) |
| 46 | { |
| 47 | std::vector<unsigned char> buffer(10, 0); |
| 48 | |
| 49 | const uint64_t profilingGuid = 123456u; |
| 50 | const std::string label = "some label"; |
| 51 | unsigned int numberOfBytesWritten = 789u; |
| 52 | TimelinePacketStatus result = WriteTimelineLabelBinaryPacket(profilingGuid, |
| 53 | label, |
| 54 | buffer.data(), |
| 55 | boost::numeric_cast<unsigned int>(buffer.size()), |
| 56 | numberOfBytesWritten); |
| 57 | BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion); |
| 58 | BOOST_CHECK(numberOfBytesWritten == 0); |
| 59 | } |
| 60 | |
| 61 | BOOST_AUTO_TEST_CASE(TimelineLabelPacketTest4) |
| 62 | { |
| 63 | std::vector<unsigned char> buffer(512, 0); |
| 64 | |
| 65 | const uint64_t profilingGuid = 123456u; |
| 66 | const std::string label = "s0m€ l@b€l"; |
| 67 | unsigned int numberOfBytesWritten = 789u; |
| 68 | TimelinePacketStatus result = WriteTimelineLabelBinaryPacket(profilingGuid, |
| 69 | label, |
| 70 | buffer.data(), |
| 71 | boost::numeric_cast<unsigned int>(buffer.size()), |
| 72 | numberOfBytesWritten); |
| 73 | BOOST_CHECK(result == TimelinePacketStatus::Error); |
| 74 | BOOST_CHECK(numberOfBytesWritten == 0); |
| 75 | } |
| 76 | |
| 77 | BOOST_AUTO_TEST_CASE(TimelineLabelPacketTest5) |
| 78 | { |
| 79 | std::vector<unsigned char> buffer(512, 0); |
| 80 | |
| 81 | const uint64_t profilingGuid = 123456u; |
| 82 | const std::string label = "some label"; |
| 83 | unsigned int numberOfBytesWritten = 789u; |
| 84 | TimelinePacketStatus result = WriteTimelineLabelBinaryPacket(profilingGuid, |
| 85 | label, |
| 86 | buffer.data(), |
| 87 | boost::numeric_cast<unsigned int>(buffer.size()), |
| 88 | numberOfBytesWritten); |
| 89 | BOOST_CHECK(result == TimelinePacketStatus::Ok); |
Jan Eilers | b884ea4 | 2019-10-16 09:54:15 +0100 | [diff] [blame^] | 90 | BOOST_CHECK(numberOfBytesWritten == 36); |
Matteo Martincigh | 0aed4f9 | 2019-10-01 14:25:34 +0100 | [diff] [blame] | 91 | |
| 92 | unsigned int uint32_t_size = sizeof(uint32_t); |
| 93 | unsigned int uint64_t_size = sizeof(uint64_t); |
| 94 | |
| 95 | // Check the packet header |
| 96 | unsigned int offset = 0; |
| 97 | uint32_t packetHeaderWord0 = ReadUint32(buffer.data(), offset); |
| 98 | uint32_t packetFamily = (packetHeaderWord0 >> 26) & 0x0000003F; |
| 99 | uint32_t packetClass = (packetHeaderWord0 >> 19) & 0x0000007F; |
| 100 | uint32_t packetType = (packetHeaderWord0 >> 16) & 0x00000007; |
| 101 | uint32_t streamId = (packetHeaderWord0 >> 0) & 0x00000007; |
| 102 | BOOST_CHECK(packetFamily == 1); |
| 103 | BOOST_CHECK(packetClass == 0); |
| 104 | BOOST_CHECK(packetType == 1); |
| 105 | BOOST_CHECK(streamId == 0); |
| 106 | |
| 107 | offset += uint32_t_size; |
| 108 | uint32_t packetHeaderWord1 = ReadUint32(buffer.data(), offset); |
| 109 | uint32_t sequenceNumbered = (packetHeaderWord1 >> 24) & 0x00000001; |
| 110 | uint32_t dataLength = (packetHeaderWord1 >> 0) & 0x00FFFFFF; |
| 111 | BOOST_CHECK(sequenceNumbered == 0); |
Jan Eilers | b884ea4 | 2019-10-16 09:54:15 +0100 | [diff] [blame^] | 112 | BOOST_CHECK(dataLength == 28); |
| 113 | |
| 114 | // Check decl_Id |
| 115 | offset += uint32_t_size; |
| 116 | uint32_t decl_Id = ReadUint32(buffer.data(), offset); |
| 117 | BOOST_CHECK(decl_Id == uint32_t(0)); |
Matteo Martincigh | 0aed4f9 | 2019-10-01 14:25:34 +0100 | [diff] [blame] | 118 | |
| 119 | // Check the profiling GUID |
| 120 | offset += uint32_t_size; |
| 121 | uint64_t readProfilingGuid = ReadUint64(buffer.data(), offset); |
| 122 | BOOST_CHECK(readProfilingGuid == profilingGuid); |
| 123 | |
| 124 | // Check the SWTrace label |
| 125 | offset += uint64_t_size; |
| 126 | uint32_t swTraceLabelLength = ReadUint32(buffer.data(), offset); |
| 127 | BOOST_CHECK(swTraceLabelLength == 11); // Label length including the null-terminator |
| 128 | |
| 129 | offset += uint32_t_size; |
| 130 | BOOST_CHECK(std::memcmp(buffer.data() + offset, // Offset to the label in the buffer |
| 131 | label.data(), // The original label |
| 132 | swTraceLabelLength - 1) == 0); // The length of the label |
| 133 | |
| 134 | offset += swTraceLabelLength * uint32_t_size; |
| 135 | BOOST_CHECK(buffer[offset] == '\0'); // The null-terminator at the end of the SWTrace label |
| 136 | } |
| 137 | |
Sadik Armagan | 784db77 | 2019-10-08 15:05:38 +0100 | [diff] [blame] | 138 | BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTest1) |
| 139 | { |
| 140 | unsigned int numberOfBytesWritten = 789u; |
| 141 | TimelinePacketStatus result = WriteTimelineMessageDirectoryPackage(nullptr, |
| 142 | 512u, |
| 143 | numberOfBytesWritten); |
| 144 | BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion); |
| 145 | BOOST_CHECK(numberOfBytesWritten == 0); |
| 146 | } |
| 147 | |
| 148 | BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTest2) |
| 149 | { |
| 150 | std::vector<unsigned char> buffer(512, 0); |
| 151 | |
| 152 | unsigned int numberOfBytesWritten = 789u; |
| 153 | TimelinePacketStatus result = WriteTimelineMessageDirectoryPackage(buffer.data(), |
| 154 | 0, |
| 155 | numberOfBytesWritten); |
| 156 | BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion); |
| 157 | BOOST_CHECK(numberOfBytesWritten == 0); |
| 158 | } |
| 159 | |
| 160 | BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTest3) |
| 161 | { |
| 162 | std::vector<unsigned char> buffer(512, 0); |
| 163 | unsigned int numberOfBytesWritten = 789u; |
| 164 | TimelinePacketStatus result = WriteTimelineMessageDirectoryPackage(buffer.data(), |
| 165 | boost::numeric_cast<unsigned int>(buffer.size()), |
| 166 | numberOfBytesWritten); |
| 167 | BOOST_CHECK(result == TimelinePacketStatus::Ok); |
| 168 | |
| 169 | BOOST_CHECK(numberOfBytesWritten == 424); |
| 170 | |
| 171 | unsigned int uint32_t_size = sizeof(uint32_t); |
| 172 | |
| 173 | // Check the packet header |
| 174 | unsigned int offset = 0; |
| 175 | uint32_t packetHeaderWord0 = ReadUint32(buffer.data(), offset); |
| 176 | uint32_t packetFamily = (packetHeaderWord0 >> 26) & 0x0000003F; |
| 177 | uint32_t packetClass = (packetHeaderWord0 >> 19) & 0x0000007F; |
| 178 | uint32_t packetType = (packetHeaderWord0 >> 16) & 0x00000007; |
| 179 | uint32_t streamId = (packetHeaderWord0 >> 0) & 0x00000007; |
| 180 | BOOST_CHECK(packetFamily == 1); |
| 181 | BOOST_CHECK(packetClass == 0); |
| 182 | BOOST_CHECK(packetType == 0); |
| 183 | BOOST_CHECK(streamId == 0); |
| 184 | |
| 185 | offset += uint32_t_size; |
| 186 | uint32_t packetHeaderWord1 = ReadUint32(buffer.data(), offset); |
| 187 | uint32_t sequenceNumbered = (packetHeaderWord1 >> 24) & 0x00000001; |
| 188 | uint32_t dataLength = (packetHeaderWord1 >> 0) & 0x00FFFFFF; |
| 189 | BOOST_CHECK(sequenceNumbered == 0); |
| 190 | BOOST_CHECK(dataLength == 416); |
| 191 | |
| 192 | // Check the decl_id |
| 193 | offset += uint32_t_size; |
| 194 | uint32_t readDeclId = ReadUint32(buffer.data(), offset); |
| 195 | BOOST_CHECK(readDeclId == 0); |
| 196 | |
| 197 | // SWTrace "namestring" format |
| 198 | // length of the string (first 4 bytes) + string + null terminator |
| 199 | |
| 200 | // Check the decl_name |
| 201 | offset += uint32_t_size; |
| 202 | uint32_t swTraceDeclNameLength = ReadUint32(buffer.data(), offset); |
| 203 | BOOST_CHECK(swTraceDeclNameLength == 13); // decl_name length including the null-terminator |
| 204 | |
| 205 | std::string label = "declareLabel"; |
| 206 | offset += uint32_t_size; |
| 207 | BOOST_CHECK(std::memcmp(buffer.data() + offset, // Offset to the label in the buffer |
| 208 | label.data(), // The original label |
| 209 | swTraceDeclNameLength - 1) == 0); // The length of the label |
| 210 | |
| 211 | // Check the ui_name |
| 212 | std::vector<uint32_t> swTraceString; |
| 213 | StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString); |
| 214 | offset += (boost::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size; |
| 215 | uint32_t swTraceUINameLength = ReadUint32(buffer.data(), offset); |
| 216 | BOOST_CHECK(swTraceUINameLength == 14); // ui_name length including the null-terminator |
| 217 | |
| 218 | label = "declare label"; |
| 219 | offset += uint32_t_size; |
| 220 | BOOST_CHECK(std::memcmp(buffer.data() + offset, // Offset to the label in the buffer |
| 221 | label.data(), // The original label |
| 222 | swTraceUINameLength - 1) == 0); // The length of the label |
| 223 | |
| 224 | // Check arg_types |
| 225 | StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString); |
| 226 | offset += (boost::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size; |
| 227 | uint32_t swTraceArgTypesLength = ReadUint32(buffer.data(), offset); |
| 228 | BOOST_CHECK(swTraceArgTypesLength == 3); // arg_types length including the null-terminator |
| 229 | |
| 230 | label = "ps"; |
| 231 | offset += uint32_t_size; |
| 232 | BOOST_CHECK(std::memcmp(buffer.data() + offset, // Offset to the label in the buffer |
| 233 | label.data(), // The original label |
| 234 | swTraceArgTypesLength - 1) == 0); // The length of the label |
| 235 | |
| 236 | // Check arg_names |
| 237 | StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString); |
| 238 | offset += (boost::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size; |
| 239 | uint32_t swTraceArgNamesLength = ReadUint32(buffer.data(), offset); |
| 240 | BOOST_CHECK(swTraceArgNamesLength == 11); // arg_names length including the null-terminator |
| 241 | |
| 242 | label = "guid,value"; |
| 243 | offset += uint32_t_size; |
| 244 | BOOST_CHECK(std::memcmp(buffer.data() + offset, // Offset to the label in the buffer |
| 245 | label.data(), // The original label |
| 246 | swTraceArgNamesLength - 1) == 0); // The length of the label |
| 247 | |
| 248 | // Check second message decl_id |
| 249 | StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString); |
| 250 | offset += (boost::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size; |
| 251 | readDeclId = ReadUint32(buffer.data(), offset); |
| 252 | BOOST_CHECK(readDeclId == 1); |
| 253 | |
| 254 | // Check second decl_name |
| 255 | offset += uint32_t_size; |
| 256 | swTraceDeclNameLength = ReadUint32(buffer.data(), offset); |
| 257 | BOOST_CHECK(swTraceDeclNameLength == 14); // decl_name length including the null-terminator |
| 258 | |
| 259 | label = "declareEntity"; |
| 260 | offset += uint32_t_size; |
| 261 | BOOST_CHECK(std::memcmp(buffer.data() + offset, // Offset to the label in the buffer |
| 262 | label.data(), // The original label |
| 263 | swTraceDeclNameLength - 1) == 0); // The length of the label |
| 264 | } |
| 265 | |
David Monahan | f21f606 | 2019-10-07 15:11:15 +0100 | [diff] [blame] | 266 | BOOST_AUTO_TEST_CASE(TimelineEntityPacketTest1) |
| 267 | { |
| 268 | const uint64_t profilingGuid = 123456u; |
| 269 | unsigned int numberOfBytesWritten = 789u; |
| 270 | TimelinePacketStatus result = WriteTimelineEntityBinaryPacket(profilingGuid, |
| 271 | nullptr, |
| 272 | 512u, |
| 273 | numberOfBytesWritten); |
| 274 | BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion); |
| 275 | BOOST_CHECK(numberOfBytesWritten == 0); |
| 276 | } |
| 277 | |
| 278 | BOOST_AUTO_TEST_CASE(TimelineEntityPacketTest2) |
| 279 | { |
| 280 | std::vector<unsigned char> buffer(512, 0); |
| 281 | |
| 282 | const uint64_t profilingGuid = 123456u; |
| 283 | unsigned int numberOfBytesWritten = 789u; |
| 284 | TimelinePacketStatus result = WriteTimelineEntityBinaryPacket(profilingGuid, |
| 285 | buffer.data(), |
| 286 | 0, |
| 287 | numberOfBytesWritten); |
| 288 | BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion); |
| 289 | BOOST_CHECK(numberOfBytesWritten == 0); |
| 290 | } |
| 291 | |
| 292 | BOOST_AUTO_TEST_CASE(TimelineEntityPacketTest3) |
| 293 | { |
| 294 | std::vector<unsigned char> buffer(10, 0); |
| 295 | |
| 296 | const uint64_t profilingGuid = 123456u; |
| 297 | unsigned int numberOfBytesWritten = 789u; |
| 298 | TimelinePacketStatus result = WriteTimelineEntityBinaryPacket(profilingGuid, |
| 299 | buffer.data(), |
| 300 | boost::numeric_cast<unsigned int>(buffer.size()), |
| 301 | numberOfBytesWritten); |
| 302 | BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion); |
| 303 | BOOST_CHECK(numberOfBytesWritten == 0); |
| 304 | } |
| 305 | |
| 306 | BOOST_AUTO_TEST_CASE(TimelineEntityPacketTest4) |
| 307 | { |
| 308 | std::vector<unsigned char> buffer(512, 0); |
| 309 | |
| 310 | const uint64_t profilingGuid = 123456u; |
| 311 | unsigned int numberOfBytesWritten = 789u; |
| 312 | TimelinePacketStatus result = WriteTimelineEntityBinaryPacket(profilingGuid, |
| 313 | buffer.data(), |
| 314 | boost::numeric_cast<unsigned int>(buffer.size()), |
| 315 | numberOfBytesWritten); |
| 316 | BOOST_CHECK(result == TimelinePacketStatus::Ok); |
Jan Eilers | b884ea4 | 2019-10-16 09:54:15 +0100 | [diff] [blame^] | 317 | BOOST_CHECK(numberOfBytesWritten == 20); |
David Monahan | f21f606 | 2019-10-07 15:11:15 +0100 | [diff] [blame] | 318 | |
| 319 | unsigned int uint32_t_size = sizeof(uint32_t); |
| 320 | |
| 321 | // Check the packet header |
| 322 | unsigned int offset = 0; |
| 323 | uint32_t packetHeaderWord0 = ReadUint32(buffer.data(), offset); |
| 324 | uint32_t packetFamily = (packetHeaderWord0 >> 26) & 0x0000003F; |
| 325 | uint32_t packetClass = (packetHeaderWord0 >> 19) & 0x0000007F; |
| 326 | uint32_t packetType = (packetHeaderWord0 >> 16) & 0x00000007; |
| 327 | uint32_t streamId = (packetHeaderWord0 >> 0) & 0x00000007; |
| 328 | BOOST_CHECK(packetFamily == 1); |
| 329 | BOOST_CHECK(packetClass == 0); |
| 330 | BOOST_CHECK(packetType == 1); |
| 331 | BOOST_CHECK(streamId == 0); |
| 332 | |
| 333 | offset += uint32_t_size; |
| 334 | uint32_t packetHeaderWord1 = ReadUint32(buffer.data(), offset); |
| 335 | uint32_t sequenceNumbered = (packetHeaderWord1 >> 24) & 0x00000001; |
| 336 | uint32_t dataLength = (packetHeaderWord1 >> 0) & 0x00FFFFFF; |
| 337 | BOOST_CHECK(sequenceNumbered == 0); |
| 338 | BOOST_CHECK(dataLength == 8); |
| 339 | |
Jan Eilers | b884ea4 | 2019-10-16 09:54:15 +0100 | [diff] [blame^] | 340 | // Check decl_Id |
| 341 | offset += uint32_t_size; |
| 342 | uint32_t decl_Id = ReadUint32(buffer.data(), offset); |
| 343 | BOOST_CHECK(decl_Id == uint32_t(1)); |
| 344 | |
David Monahan | f21f606 | 2019-10-07 15:11:15 +0100 | [diff] [blame] | 345 | // Check the profiling GUID |
| 346 | offset += uint32_t_size; |
| 347 | uint64_t readProfilingGuid = ReadUint64(buffer.data(), offset); |
| 348 | BOOST_CHECK(readProfilingGuid == profilingGuid); |
| 349 | } |
| 350 | |
Jan Eilers | 92fa15b | 2019-10-15 15:23:25 +0100 | [diff] [blame] | 351 | BOOST_AUTO_TEST_CASE(TimelineEventClassTest1) |
| 352 | { |
| 353 | const uint64_t profilingGuid = 123456u; |
| 354 | unsigned int numberOfBytesWritten = 789u; |
| 355 | TimelinePacketStatus result = WriteTimelineEventClassBinaryPacket(profilingGuid, |
| 356 | nullptr, |
| 357 | 512u, |
| 358 | numberOfBytesWritten); |
| 359 | BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion); |
| 360 | BOOST_CHECK(numberOfBytesWritten == 0); |
| 361 | } |
| 362 | |
| 363 | BOOST_AUTO_TEST_CASE(TimelineEventClassTest2) |
| 364 | { |
| 365 | std::vector<unsigned char> buffer(512, 0); |
| 366 | |
| 367 | const uint64_t profilingGuid = 123456u; |
| 368 | unsigned int numberOfBytesWritten = 789u; |
| 369 | TimelinePacketStatus result = WriteTimelineEventClassBinaryPacket(profilingGuid, |
| 370 | buffer.data(), |
| 371 | 0, |
| 372 | numberOfBytesWritten); |
| 373 | BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion); |
| 374 | BOOST_CHECK(numberOfBytesWritten == 0); |
| 375 | } |
| 376 | |
| 377 | BOOST_AUTO_TEST_CASE(TimelineEventClassTest3) |
| 378 | { |
| 379 | std::vector<unsigned char> buffer(10, 0); |
| 380 | |
| 381 | const uint64_t profilingGuid = 123456u; |
| 382 | unsigned int numberOfBytesWritten = 789u; |
| 383 | TimelinePacketStatus result = WriteTimelineEventClassBinaryPacket(profilingGuid, |
| 384 | buffer.data(), |
| 385 | boost::numeric_cast<unsigned int>(buffer.size()), |
| 386 | numberOfBytesWritten); |
| 387 | BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion); |
| 388 | BOOST_CHECK(numberOfBytesWritten == 0); |
| 389 | } |
| 390 | |
| 391 | BOOST_AUTO_TEST_CASE(TimelineEventClassTest4) |
| 392 | { |
| 393 | std::vector<unsigned char> buffer(512, 0); |
| 394 | |
| 395 | const uint64_t profilingGuid = 123456u; |
| 396 | unsigned int numberOfBytesWritten = 789u; |
| 397 | TimelinePacketStatus result = WriteTimelineEventClassBinaryPacket(profilingGuid, |
| 398 | buffer.data(), |
| 399 | boost::numeric_cast<unsigned int>(buffer.size()), |
| 400 | numberOfBytesWritten); |
| 401 | BOOST_CHECK(result == TimelinePacketStatus::Ok); |
| 402 | BOOST_CHECK(numberOfBytesWritten == 20); |
| 403 | |
| 404 | unsigned int uint32_t_size = sizeof(uint32_t); |
| 405 | |
| 406 | // Check the packet header |
| 407 | unsigned int offset = 0; |
| 408 | uint32_t packetHeaderWord0 = ReadUint32(buffer.data(), offset); |
| 409 | uint32_t packetFamily = (packetHeaderWord0 >> 26) & 0x0000003F; |
| 410 | uint32_t packetClass = (packetHeaderWord0 >> 19) & 0x0000007F; |
| 411 | uint32_t packetType = (packetHeaderWord0 >> 16) & 0x00000007; |
| 412 | uint32_t streamId = (packetHeaderWord0 >> 0) & 0x00000007; |
| 413 | BOOST_CHECK(packetFamily == 1); |
| 414 | BOOST_CHECK(packetClass == 0); |
| 415 | BOOST_CHECK(packetType == 1); |
| 416 | BOOST_CHECK(streamId == 0); |
| 417 | |
| 418 | offset += uint32_t_size; |
| 419 | uint32_t packetHeaderWord1 = ReadUint32(buffer.data(), offset); |
| 420 | uint32_t sequenceNumbered = (packetHeaderWord1 >> 24) & 0x00000001; |
| 421 | uint32_t dataLength = (packetHeaderWord1 >> 0) & 0x00FFFFFF; |
| 422 | BOOST_CHECK(sequenceNumbered == 0); |
| 423 | BOOST_CHECK(dataLength == 12); |
| 424 | |
| 425 | // Check the decl_id |
| 426 | offset += uint32_t_size; |
| 427 | uint32_t declId = ReadUint32(buffer.data(), offset); |
| 428 | BOOST_CHECK(declId == uint32_t(2)); |
| 429 | |
| 430 | // Check the profiling GUID |
| 431 | offset += uint32_t_size; |
| 432 | uint64_t readProfilingGuid = ReadUint64(buffer.data(), offset); |
| 433 | BOOST_CHECK(readProfilingGuid == profilingGuid); |
| 434 | } |
| 435 | |
Jan Eilers | b884ea4 | 2019-10-16 09:54:15 +0100 | [diff] [blame^] | 436 | BOOST_AUTO_TEST_SUITE_END() // TimelinePacketTests |