void BufferQueueDump::dumpObtainedBufs() { String8 name; const char* bufName = (TRACK_PRODUCER == mMode) ? "Dequeued" : "Acquired"; getDumpFileName(name, mName); // dump acquired buffers if (!mObtainedBufs.size()) { // if no acquired buf, try to dump the last one kept if (mLastObtainedBuf != NULL) { String8 name_prefix = String8::format("[%s](LAST_ts%lld)", name.string(), ns2ms(mLastObtainedBuf->mTimeStamp)); mLastObtainedBuf->dump(name_prefix); BQD_LOGD("[dump] LAYER, handle(%p)", mLastObtainedBuf->mGraphicBuffer->handle); } } else { // dump acquired buf old to new for (uint32_t i = 0; i < mObtainedBufs.size(); i++) { const sp<DumpBuffer>& buffer = mObtainedBufs[i]; if (buffer->mGraphicBuffer != NULL) { String8 name_prefix = String8::format("[%s](%s%02u_ts%lld)", name.string(), bufName, i, ns2ms(buffer->mTimeStamp)); buffer->dump(name_prefix); BQD_LOGD("[dump] %s:%02u, handle(%p)", bufName, i, buffer->mGraphicBuffer->handle); } } } }
void GPS::initializeCommunicationDump() { param_t gps_dump_comm_ph = param_find("GPS_DUMP_COMM"); int32_t param_dump_comm; if (gps_dump_comm_ph == PARAM_INVALID || param_get(gps_dump_comm_ph, ¶m_dump_comm) != 0) { return; } if (param_dump_comm != 1) { return; //dumping disabled } char to_device_file_name[128] = ""; char from_device_file_name[128] = ""; if (getDumpFileName(to_device_file_name, sizeof(to_device_file_name), "to") || getDumpFileName(from_device_file_name, sizeof(from_device_file_name), "from")) { PX4_ERR("Failed to get GPS dump file name"); return; } //open files if ((_dump_to_gps_device_fd = open(to_device_file_name, O_CREAT | O_WRONLY | O_TRUNC, PX4_O_MODE_666)) < 0) { return; } if ((_dump_from_gps_device_fd = open(from_device_file_name, O_CREAT | O_WRONLY | O_TRUNC, PX4_O_MODE_666)) < 0) { close(_dump_to_gps_device_fd); _dump_to_gps_device_fd = -1; return; } PX4_INFO("Dumping GPS comm to files %s, %s", to_device_file_name, from_device_file_name); _vehicle_status_sub = orb_subscribe(ORB_ID(vehicle_status)); }
void BufferQueueDump::dumpBuffer() const { char value[PROPERTY_VALUE_MAX]; property_get(PROP_DUMP_NAME, value, DEFAULT_DUMP_NAME); if (strstr(value, PREFIX_NODUMP) == value) { // find prefix for no dump return; } if (!((!strcmp(value, STR_DUMPALL)) || (-1 != mName.find(value)))) { // no dump for me return; } // at first, dump backup buffer if needed if (mBackupBuf.getSize() > 0) { // dump all backup buffer mBackupBuf.dump(); } String8 name; String8 prefix; getDumpFileName(name, mName); uint32_t offset = mBackupBuf.getValidSize(); // dump acquired buffers for (uint32_t i = 0; i < mAcquiredBufs.size(); i++) { if (mAcquiredBufs[i]->mGraphicBuffer != NULL) { prefix = String8::format("%s_%u_ts%lldms", name.string(), offset + i, ns2ms(mAcquiredBufs[i]->mTimeStamp)); if (mAcquiredBufs[i]->mFence != NULL) mAcquiredBufs[i]->mFence->waitForever("BufferQueue::Dump::dumpBuffer"); GraphicBufferExtra::dump(mAcquiredBufs[i]->mGraphicBuffer, prefix.string(), DUMP_FILE_PATH); ST_LOGD("dumpBuffer: dump acquired buffer %u", i); } } }