Skip to content

Commit

Permalink
Remove more instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
panos-lunarg committed Sep 9, 2024
1 parent 4d6bd1c commit 5c70695
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 41 deletions.
12 changes: 6 additions & 6 deletions framework/decode/asset_file_consumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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_)
Expand All @@ -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_)
Expand Down Expand Up @@ -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_)
Expand Down Expand Up @@ -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_));
}

Expand Down
26 changes: 13 additions & 13 deletions framework/decode/asset_file_consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions framework/decode/vulkan_replay_consumer_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
{
Expand All @@ -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)
Expand All @@ -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)
{
Expand Down
6 changes: 3 additions & 3 deletions framework/encode/capture_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand All @@ -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_;
}
}
Expand Down
36 changes: 23 additions & 13 deletions framework/encode/vulkan_state_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand All @@ -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_;
}
Expand All @@ -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();

Expand Down Expand Up @@ -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_;
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit 5c70695

Please sign in to comment.