From 5c70695cdb817b581c0411848466f4c1499c6e10 Mon Sep 17 00:00:00 2001 From: Panagiotis Apostolou Date: Mon, 9 Sep 2024 17:58:21 +0300 Subject: [PATCH] Remove more instrumentation --- framework/decode/asset_file_consumer.cpp | 12 +++---- framework/decode/asset_file_consumer.h | 26 +++++++------- .../decode/vulkan_replay_consumer_base.cpp | 12 +++---- framework/encode/capture_manager.cpp | 6 ++-- framework/encode/vulkan_state_writer.cpp | 36 ++++++++++++------- 5 files changed, 51 insertions(+), 41 deletions(-) diff --git a/framework/decode/asset_file_consumer.cpp b/framework/decode/asset_file_consumer.cpp index 9d7fb5b07..875cf691a 100644 --- a/framework/decode/asset_file_consumer.cpp +++ b/framework/decode/asset_file_consumer.cpp @@ -52,8 +52,8 @@ void AssetFileConsumer::ProcessFrameBeginMarker(uint64_t frame_number) asset_file_offsets_[frame_number] = last_frame_entry->second; } - fprintf(debug_, "%s() %" PRId64 "\n", __func__, frame_number); - fsync(fileno(debug_)); + // fprintf(debug_, "%s() %" PRId64 "\n", __func__, frame_number); + // fsync(fileno(debug_)); } void AssetFileConsumer::ProcessInitBufferCommand(format::HandleId device_id, @@ -67,7 +67,7 @@ void AssetFileConsumer::ProcessInitBufferCommand(format::HandleId device_id, format::FrameAssetFileOffsets& frame_offsets = asset_file_offsets_[current_frame_]; frame_offsets[buffer_id] = block_header_file_offset_; - fprintf(debug_, "buffer %" PRIu64 " -> %" PRId64 "\n", buffer_id, block_header_file_offset_); + // fprintf(debug_, "buffer %" PRIu64 " -> %" PRId64 "\n", buffer_id, block_header_file_offset_); // fsync(fileno(debug_)); if (buffer_id > greatest_id_) @@ -93,7 +93,7 @@ void AssetFileConsumer::ProcessInitImageCommand(format::HandleId dev format::FrameAssetFileOffsets& frame_offsets = asset_file_offsets_[current_frame_]; frame_offsets[image_id] = block_header_file_offset_; - fprintf(debug_, "image %" PRIu64 " -> %" PRId64 "\n", image_id, block_header_file_offset_); + // fprintf(debug_, "image %" PRIu64 " -> %" PRId64 "\n", image_id, block_header_file_offset_); // fsync(fileno(debug_)); if (image_id > greatest_id_) @@ -121,7 +121,7 @@ void AssetFileConsumer::Process_vkAllocateDescriptorSets( format::FrameAssetFileOffsets& frame_offsets = asset_file_offsets_[current_frame_]; asset_file_offsets_[current_frame_][desc_id] = block_header_file_offset_; - fprintf(debug_, "%" PRIu64 " -> %" PRId64 "\n", desc_id, block_header_file_offset_); + // fprintf(debug_, "%" PRIu64 " -> %" PRId64 "\n", desc_id, block_header_file_offset_); // fsync(fileno(debug_)); if (desc_id > greatest_id_) @@ -150,7 +150,7 @@ void AssetFileConsumer::Process_vkUpdateDescriptorSets( const auto new_entry = frame_offsets.insert({ desc_id, block_header_file_offset_ }); if (new_entry.second) { - fprintf(debug_, "%" PRIu64 " -> %" PRId64 "\n", desc_id, block_header_file_offset_); + // fprintf(debug_, "%" PRIu64 " -> %" PRId64 "\n", desc_id, block_header_file_offset_); // fsync(fileno(debug_)); } diff --git a/framework/decode/asset_file_consumer.h b/framework/decode/asset_file_consumer.h index d54342acd..d420abc57 100644 --- a/framework/decode/asset_file_consumer.h +++ b/framework/decode/asset_file_consumer.h @@ -42,22 +42,22 @@ class AssetFileConsumer : public VulkanConsumer public: AssetFileConsumer() : current_frame_(0), greatest_id_(0) { -#if defined(VK_USE_PLATFORM_ANDROID_KHR) - if (util::platform::FileOpen(&debug_, "/storage/emulated/0/Download/AssetFileConsumer2.txt", "a")) -#else - if (util::platform::FileOpen(&debug_, "AssetFileConsumer.txt", "a")) -#endif - { - assert(0); - } +// #if defined(VK_USE_PLATFORM_ANDROID_KHR) +// if (util::platform::FileOpen(&debug_, "/storage/emulated/0/Download/AssetFileConsumer2.txt", "a")) +// #else +// if (util::platform::FileOpen(&debug_, "AssetFileConsumer.txt", "a")) +// #endif +// { +// assert(0); +// } } ~AssetFileConsumer() { - if (debug_) - { - util::platform::FileClose(debug_); - } + // if (debug_) + // { + // util::platform::FileClose(debug_); + // } } virtual void ProcessFrameBeginMarker(uint64_t frame_number) override; @@ -108,7 +108,7 @@ class AssetFileConsumer : public VulkanConsumer format::AssetFileOffsets asset_file_offsets_; format::FrameNumber current_frame_; format::HandleId greatest_id_; - FILE* debug_; + // FILE* debug_; }; GFXRECON_END_NAMESPACE(gfxrecon) diff --git a/framework/decode/vulkan_replay_consumer_base.cpp b/framework/decode/vulkan_replay_consumer_base.cpp index aa7bacea3..fbc7770f3 100644 --- a/framework/decode/vulkan_replay_consumer_base.cpp +++ b/framework/decode/vulkan_replay_consumer_base.cpp @@ -287,8 +287,8 @@ void VulkanReplayConsumerBase::ProcessStateBeginMarker(uint64_t frame_number) // If a trace file has the state begin marker, it must be a trim trace file. replaying_trimmed_capture_ = true; - GFXRECON_WRITE_CONSOLE("%s() current_frame_: %" PRIu64, __func__, current_frame_) - GFXRECON_WRITE_CONSOLE("%s() frame_number: %" PRIu64, __func__, frame_number) + // GFXRECON_WRITE_CONSOLE("%s() current_frame_: %" PRIu64, __func__, current_frame_) + // GFXRECON_WRITE_CONSOLE("%s() frame_number: %" PRIu64, __func__, frame_number) } void VulkanReplayConsumerBase::ProcessStateEndMarker(uint64_t frame_number) @@ -301,7 +301,7 @@ void VulkanReplayConsumerBase::ProcessStateEndMarker(uint64_t frame_number) } current_frame_ = frame_number; - GFXRECON_WRITE_CONSOLE("%s() current_frame_: %" PRIu64, __func__, current_frame_) + // GFXRECON_WRITE_CONSOLE("%s() current_frame_: %" PRIu64, __func__, current_frame_) if (override_frame_number_fp_ != nullptr) { @@ -311,7 +311,7 @@ void VulkanReplayConsumerBase::ProcessStateEndMarker(uint64_t frame_number) void VulkanReplayConsumerBase::ProcessFrameBeginMarker(uint64_t frame_number) { - GFXRECON_WRITE_CONSOLE("%s() frame_number: %" PRIu64, __func__, frame_number) + // GFXRECON_WRITE_CONSOLE("%s() frame_number: %" PRIu64, __func__, frame_number) current_frame_ = frame_number; if (override_frame_number_fp_ != nullptr) @@ -322,9 +322,9 @@ void VulkanReplayConsumerBase::ProcessFrameBeginMarker(uint64_t frame_number) void VulkanReplayConsumerBase::ProcessFrameEndMarker(uint64_t frame_number) { - GFXRECON_WRITE_CONSOLE("%s() frame_number: %" PRIu64, __func__, frame_number) + // GFXRECON_WRITE_CONSOLE("%s() frame_number: %" PRIu64, __func__, frame_number) current_frame_ = frame_number + 1; - GFXRECON_WRITE_CONSOLE("%s() current_frame_: %" PRIu64, __func__, current_frame_) + // GFXRECON_WRITE_CONSOLE("%s() current_frame_: %" PRIu64, __func__, current_frame_) if (override_frame_number_fp_ != nullptr) { diff --git a/framework/encode/capture_manager.cpp b/framework/encode/capture_manager.cpp index 4da861c82..27ac8a38c 100644 --- a/framework/encode/capture_manager.cpp +++ b/framework/encode/capture_manager.cpp @@ -1855,7 +1855,7 @@ void CommonCaptureManager::OverrideFrame(format::FrameNumber frame) format::HandleId CommonCaptureManager::GetUniqueId(VkObjectType type) { - GFXRECON_WRITE_CONSOLE("%s(type: %s)", __func__, VkObjectTypeToStr(type)); + // GFXRECON_WRITE_CONSOLE("%s(type: %s)", __func__, VkObjectTypeToStr(type)); if (!handle_ids_override.empty()) { @@ -1871,13 +1871,13 @@ format::HandleId CommonCaptureManager::GetUniqueId(VkObjectType type) } handle_ids_override.pop(); - GFXRECON_WRITE_CONSOLE(" Removing from stack %" PRIu64 "(%zu)", top.first, handle_ids_override.size()); + // GFXRECON_WRITE_CONSOLE(" Removing from stack %" PRIu64 "(%zu)", top.first, handle_ids_override.size()); return top.first; } else { - GFXRECON_WRITE_CONSOLE(" Incrementing %" PRIu64, unique_id_counter_ + 1); + // GFXRECON_WRITE_CONSOLE(" Incrementing %" PRIu64, unique_id_counter_ + 1); return ++unique_id_counter_; } } diff --git a/framework/encode/vulkan_state_writer.cpp b/framework/encode/vulkan_state_writer.cpp index 636333a39..c3c7ffae1 100644 --- a/framework/encode/vulkan_state_writer.cpp +++ b/framework/encode/vulkan_state_writer.cpp @@ -46,7 +46,7 @@ GFXRECON_BEGIN_NAMESPACE(gfxrecon) GFXRECON_BEGIN_NAMESPACE(encode) -static FILE* debug = nullptr; +// static FILE* debug = nullptr; const uint32_t kDefaultQueueFamilyIndex = 0; static bool IsMemoryCoherent(VkMemoryPropertyFlags property_flags) @@ -103,7 +103,7 @@ WriteFrameMarker(format::MarkerType marker_type, uint64_t frame_number, util::Fi { assert(output_stream != nullptr); - fprintf(debug, "%s() %" PRId64 "\n", __func__, frame_number); + // fprintf(debug, "%s() %" PRId64 "\n", __func__, frame_number); format::Marker marker_cmd; uint64_t header_size = sizeof(format::Marker); @@ -121,16 +121,21 @@ uint64_t VulkanStateWriter::WriteAssets(const VulkanStateTable& state_table, uin blocks_written_ = 0; - debug = fopen("/storage/emulated/0/Download/WriteState.txt", "a"); - assert(debug); +// #if defined(VK_USE_PLATFORM_ANDROID_KHR) +// debug = fopen("/storage/emulated/0/Download/WriteState.txt", "a"); +// #else +// debug = fopen("WriteState.txt", "a"); +// #endif + + // assert(debug); WriteFrameMarker(format::MarkerType::kBeginMarker, frame_number, asset_file_stream_); WriteResourceMemoryState(state_table, false); WriteDescriptorSetStateWithAssetFile(state_table); - fsync(fileno(debug)); - fclose(debug); + // fsync(fileno(debug)); + // fclose(debug); return blocks_written_; } @@ -140,8 +145,13 @@ uint64_t VulkanStateWriter::WriteState(const VulkanStateTable& state_table, uint // clang-format off blocks_written_ = 0; - debug = fopen("/storage/emulated/0/Download/WriteState.txt", "a"); - assert(debug); +// #if defined(VK_USE_PLATFORM_ANDROID_KHR) +// debug = fopen("/storage/emulated/0/Download/WriteState.txt", "a"); +// #else +// debug = fopen("WriteState.txt", "a"); +// #endif + +// assert(debug); auto started = std::chrono::high_resolution_clock::now(); @@ -252,8 +262,8 @@ uint64_t VulkanStateWriter::WriteState(const VulkanStateTable& state_table, uint asset_file_stream_->Flush(); } - fsync(fileno(debug)); - fclose(debug); + // fsync(fileno(debug)); + // fclose(debug); // For the EndMarker meta command ++blocks_written_; @@ -1161,7 +1171,7 @@ void VulkanStateWriter::WriteDescriptorSetStateWithAssetFile(const VulkanStateTa wrapper->dirty = false; (*asset_file_offsets_)[wrapper->handle_id] = offset; - fprintf(debug, "%" PRIu64 " -> %" PRId64 "\n", wrapper->handle_id, offset); + // fprintf(debug, "%" PRIu64 " -> %" PRId64 "\n", wrapper->handle_id, offset); } else { @@ -1773,7 +1783,7 @@ void VulkanStateWriter::ProcessBufferMemoryWithAssetFile(const vulkan_wrappers:: asset_file_stream_->Write(bytes, data_size); (*asset_file_offsets_)[buffer_wrapper->handle_id] = offset; - fprintf(debug, "buffer %" PRIu64 " -> %" PRId64 "\n", buffer_wrapper->handle_id, offset); + // fprintf(debug, "buffer %" PRIu64 " -> %" PRId64 "\n", buffer_wrapper->handle_id, offset); if (output_stream_ != nullptr) { @@ -2105,7 +2115,7 @@ void VulkanStateWriter::ProcessImageMemoryWithAssetFile(const vulkan_wrappers::D asset_file_stream_->Write(snapshot_entry.level_sizes.data(), levels_size); asset_file_stream_->Write(bytes, data_size); - fprintf(debug, "image %" PRIu64 " -> %" PRId64 "\n", image_wrapper->handle_id, offset); + // fprintf(debug, "image %" PRIu64 " -> %" PRId64 "\n", image_wrapper->handle_id, offset); if (output_stream_ != nullptr) {