Skip to content
Draft
36 changes: 36 additions & 0 deletions SerialPrograms/Source/Pokemon/AutoStory/Pokemon_AutoStoryStats.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* AutoStory Stats
*
* From: https://github.com/PokemonAutomation/
*
*/

#ifndef PokemonAutomation_Pokemon_AutoStoryStats_H
#define PokemonAutomation_Pokemon_AutoStoryStats_H

#include "CommonFramework/ProgramStats/StatsTracking.h"

namespace PokemonAutomation{
namespace Pokemon{


// Saved checkpoints, segments started and game resets of an AutoStory run.
// The names are the keys of the saved stats; do not rename them.
struct AutoStoryStats : public StatsTracker{
AutoStoryStats()
: m_checkpoint(m_stats["Checkpoint"])
, m_segment(m_stats["Segment"])
, m_reset(m_stats["Reset"])
{
m_display_order.emplace_back("Checkpoint");
m_display_order.emplace_back("Segment");
m_display_order.emplace_back("Reset");
}
std::atomic<uint64_t>& m_checkpoint;
std::atomic<uint64_t>& m_segment;
std::atomic<uint64_t>& m_reset;
};


} // namespace Pokemon
} // namespace PokemonAutomation
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "ML/Inference/ML_YOLOv5Detector.h"
#include "ML/Inference/ML_YOLONavigation.h"
#include "NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h"
#include "Pokemon/AutoStory/Pokemon_AutoStoryStats.h"
#include "VideoGames/PokemonSV/Programs/PokemonSV_WorldNavigation.h"

namespace PokemonAutomation{
Expand All @@ -24,20 +25,8 @@ using namespace ML;

static constexpr bool ENABLE_TEST = false;

struct AutoStoryStats : public StatsTracker{
AutoStoryStats()
: m_checkpoint(m_stats["Checkpoint"])
, m_segment(m_stats["Segment"])
, m_reset(m_stats["Reset"])
{
m_display_order.emplace_back("Checkpoint");
m_display_order.emplace_back("Segment");
m_display_order.emplace_back("Reset");
}
std::atomic<uint64_t>& m_checkpoint;
std::atomic<uint64_t>& m_segment;
std::atomic<uint64_t>& m_reset;
};
// Shared checkpoint, segment and reset counters used by SV AutoStory.
using AutoStoryStats = Pokemon::AutoStoryStats;



Expand Down
1 change: 1 addition & 0 deletions SerialPrograms/cmake/SourceFiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,7 @@ file(GLOB LIBRARY_SOURCES
Source/Pokemon/AutoStory/Pokemon_AutoStorySelect.h
Source/Pokemon/AutoStory/Pokemon_AutoStorySelect_Tests.cpp
Source/Pokemon/AutoStory/Pokemon_AutoStorySelect_Tests.h
Source/Pokemon/AutoStory/Pokemon_AutoStoryStats.h
Source/Pokemon/Pokemon_AdvRng.cpp
Source/Pokemon/Pokemon_AdvRng.h
Source/Pokemon/Pokemon_BdspRng.cpp
Expand Down
Loading