mirror of
https://github.com/holub/mame
synced 2025-04-20 15:32:45 +03:00
Create diagnostic module for profiling and crash diagnostics
This commit is contained in:
parent
4e2fefdd15
commit
ef4f80b4a4
@ -51,8 +51,11 @@ function osdmodulesbuild()
|
||||
MAME_DIR .. "src/osd/modules/midi/midi_module.h",
|
||||
MAME_DIR .. "src/osd/modules/netdev/netdev_module.h",
|
||||
MAME_DIR .. "src/osd/modules/sound/sound_module.h",
|
||||
MAME_DIR .. "src/osd/modules/diagnostics/diagnostics_module.h",
|
||||
MAME_DIR .. "src/osd/modules/lib/osdobj_common.cpp",
|
||||
MAME_DIR .. "src/osd/modules/lib/osdobj_common.h",
|
||||
MAME_DIR .. "src/osd/modules/diagnostics/none.cpp",
|
||||
MAME_DIR .. "src/osd/modules/diagnostics/diagnostics_win32.cpp",
|
||||
MAME_DIR .. "src/osd/modules/debugger/none.cpp",
|
||||
MAME_DIR .. "src/osd/modules/debugger/debugint.cpp",
|
||||
MAME_DIR .. "src/osd/modules/debugger/debugwin.cpp",
|
||||
|
42
src/osd/modules/diagnostics/diagnostics_module.h
Normal file
42
src/osd/modules/diagnostics/diagnostics_module.h
Normal file
@ -0,0 +1,42 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Brad Hughes
|
||||
/***************************************************************************
|
||||
|
||||
diagnostics_module.h
|
||||
|
||||
Diagnostics module interface
|
||||
|
||||
***************************************************************************/
|
||||
#ifndef DIAGNOSTICS_MODULE_H_
|
||||
#define DIAGNOSTICS_MODULE_H_
|
||||
|
||||
#include "osdepend.h"
|
||||
|
||||
//============================================================
|
||||
// CONSTANTS
|
||||
//============================================================
|
||||
|
||||
class diagnostics_module
|
||||
{
|
||||
public:
|
||||
diagnostics_module() { }
|
||||
|
||||
virtual ~diagnostics_module() { }
|
||||
|
||||
// initializes crash diagnostics for MAME
|
||||
virtual int init_crash_diagnostics() = 0;
|
||||
|
||||
// starts the profiler
|
||||
virtual void start_profiler(std::uint32_t max_seconds, std::uint8_t stack_depth) = 0;
|
||||
|
||||
// stops the currently active profiler
|
||||
virtual void stop_profiler() = 0;
|
||||
|
||||
// prints the results of the profiling operation
|
||||
virtual void print_profiler_results() = 0;
|
||||
|
||||
// Gets the instance of the diagnostic module
|
||||
static diagnostics_module* get_instance();
|
||||
};
|
||||
|
||||
#endif
|
1086
src/osd/modules/diagnostics/diagnostics_win32.cpp
Normal file
1086
src/osd/modules/diagnostics/diagnostics_win32.cpp
Normal file
File diff suppressed because it is too large
Load Diff
55
src/osd/modules/diagnostics/none.cpp
Normal file
55
src/osd/modules/diagnostics/none.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Brad Hughes
|
||||
//====================================================================
|
||||
//
|
||||
// none.cpp - Null implementation of diagnostic module
|
||||
//
|
||||
//====================================================================
|
||||
|
||||
#include "diagnostics_module.h"
|
||||
|
||||
class diagnostics_none : public diagnostics_module
|
||||
{
|
||||
public:
|
||||
diagnostics_none()
|
||||
{
|
||||
}
|
||||
|
||||
int init_crash_diagnostics() override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void start_profiler(std::uint32_t max_seconds, std::uint8_t stack_depth) override
|
||||
{
|
||||
}
|
||||
|
||||
void stop_profiler() override
|
||||
{
|
||||
}
|
||||
|
||||
void print_profiler_results() override
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// Determine if diagnostics_none should be used based on OSD
|
||||
#if defined(OSD_WINDOWS) || defined(SDLMAME_WIN32)
|
||||
#include <winapifamily.h>
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
#define USE_DIAG_NONE 0 // Desktop Windows
|
||||
#else
|
||||
#define USE_DIAG_NONE 1 // Universal Windows
|
||||
#endif
|
||||
#else
|
||||
#define USE_DIAG_NONE 1 // SDL and others
|
||||
#endif
|
||||
|
||||
// We we should use diagnostics_none, create the static accessor
|
||||
#if USE_DIAG_NONE
|
||||
diagnostics_module* diagnostics_module::get_instance()
|
||||
{
|
||||
static diagnostics_none s_instance;
|
||||
return &s_instance;
|
||||
}
|
||||
#endif
|
@ -196,6 +196,9 @@ int main(int argc, char *argv[])
|
||||
setvbuf(stdout, (char *) NULL, _IONBF, 0);
|
||||
setvbuf(stderr, (char *) NULL, _IONBF, 0);
|
||||
|
||||
// Initialize crash diagnostics
|
||||
diagnostics_module::get_instance()->init_crash_diagnostics();
|
||||
|
||||
#if defined(SDLMAME_ANDROID)
|
||||
/* Enable standard application logging */
|
||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_VERBOSE);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -249,8 +249,14 @@ struct MouseButtonEventArgs
|
||||
int ypos;
|
||||
};
|
||||
|
||||
// Forward declarations
|
||||
struct _EXCEPTION_POINTERS;
|
||||
|
||||
class windows_osd_interface : public osd_common_t
|
||||
{
|
||||
// Access to exception filter static method
|
||||
friend int main(int argc, char *argv[]);
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
windows_osd_interface(windows_options &options);
|
||||
@ -297,6 +303,7 @@ private:
|
||||
windows_options & m_options;
|
||||
|
||||
static const int DEFAULT_FONT_HEIGHT = 200;
|
||||
static long __stdcall exception_filter(struct _EXCEPTION_POINTERS *info);
|
||||
};
|
||||
|
||||
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
@ -337,11 +344,4 @@ extern const options_entry mame_win_options[];
|
||||
extern int osd_num_processors;
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
// FUNCTION PROTOTYPES
|
||||
//============================================================
|
||||
|
||||
void winmain_dump_stack();
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user