Skip to content

Commit

Permalink
AP_Logger: add performance debug to W25NXX logger
Browse files Browse the repository at this point in the history
  • Loading branch information
andyp1per committed Dec 7, 2024
1 parent c34b031 commit 6c40ab4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libraries/AP_Logger/AP_Logger_W25NXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ void AP_Logger_W25NXX::PageToBuffer(uint32_t pageNum)
}
}

//#define AP_W25NXX_DEBUG
#ifdef AP_W25NXX_DEBUG
static uint32_t block_writes;
static uint32_t last_write_msg_ms;
#endif
void AP_Logger_W25NXX::BufferToPage(uint32_t pageNum)
{
if (pageNum == 0 || pageNum > df_NumPages+1) {
Expand Down Expand Up @@ -283,6 +288,15 @@ void AP_Logger_W25NXX::BufferToPage(uint32_t pageNum)
WITH_SEMAPHORE(dev_sem);
send_command_addr(JEDEC_PROGRAM_EXECUTE, PageAdr);
}

#ifdef AP_W25NXX_DEBUG
block_writes++;
if (AP_HAL::millis() - last_write_msg_ms > 5000) {
hal.console->printf("W25NXX: writes %lukB/s, pages %lu/s\n", (block_writes*df_PageSize)/(5*1024), block_writes/5);
block_writes = 0;
last_write_msg_ms = AP_HAL::millis();
}
#endif
}

/*
Expand Down

0 comments on commit 6c40ab4

Please sign in to comment.