new stacktrace function in libpbd3; variable size GUI request thread queues
git-svn-id: svn://localhost/trunk/ardour2@330 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
69c9f3d7ce
commit
ae14f6c7eb
|
@ -80,7 +80,7 @@ _thread_init_callback (void *arg)
|
|||
knows about it.
|
||||
*/
|
||||
|
||||
PBD::ThreadCreated (pthread_self(), X_("Audioengine"));
|
||||
PBD::ThreadCreatedWithRequestSize (pthread_self(), X_("Audioengine"), 4096);
|
||||
|
||||
#ifdef VST_SUPPORT
|
||||
if (Config->get_use_vst()) {
|
||||
|
|
|
@ -1272,7 +1272,7 @@ Session::midi_thread_work ()
|
|||
bool restart;
|
||||
vector<MIDI::Port*> ports;
|
||||
|
||||
PBD::ThreadCreated (pthread_self(), X_("MIDI"));
|
||||
PBD::ThreadCreatedWithRequestSize (pthread_self(), X_("MIDI"), 2048);
|
||||
|
||||
memset (&rtparam, 0, sizeof (rtparam));
|
||||
rtparam.sched_priority = 9; /* XXX should be relative to audio (JACK) thread */
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <pbd/touchable.h>
|
||||
#include <pbd/failed_constructor.h>
|
||||
#include <pbd/pthread_utils.h>
|
||||
#include <pbd/stacktrace.h>
|
||||
|
||||
#include <gtkmm2ext/gtk_ui.h>
|
||||
#include <gtkmm2ext/textviewer.h>
|
||||
|
@ -59,6 +60,7 @@ UI::UI (string name, int *argc, char ***argv, string rcfile)
|
|||
}
|
||||
|
||||
PBD::ThreadCreated.connect (mem_fun (*this, &UI::register_thread));
|
||||
PBD::ThreadCreatedWithRequestSize.connect (mem_fun (*this, &UI::register_thread_with_request_count));
|
||||
|
||||
_ok = false;
|
||||
_active = false;
|
||||
|
@ -370,7 +372,13 @@ UI::timeout_add (unsigned int timeout, int (*func)(void *), void *arg)
|
|||
void
|
||||
UI::register_thread (pthread_t thread_id, string name)
|
||||
{
|
||||
RingBufferNPT<Request>* b = new RingBufferNPT<Request> (128);
|
||||
register_thread_with_request_count (thread_id, name, 256);
|
||||
}
|
||||
|
||||
void
|
||||
UI::register_thread_with_request_count (pthread_t thread_id, string name, uint32_t num_requests)
|
||||
{
|
||||
RingBufferNPT<Request>* b = new RingBufferNPT<Request> (num_requests);
|
||||
|
||||
{
|
||||
PBD::LockMonitor lm (request_buffer_map_lock, __LINE__, __FILE__);
|
||||
|
|
|
@ -70,7 +70,9 @@ class UI : public AbstractUI
|
|||
void call_slot_locked (sigc::slot<void>);
|
||||
void touch_display (Touchable *);
|
||||
void receive (Transmitter::Channel, const char *);
|
||||
|
||||
void register_thread (pthread_t, string);
|
||||
void register_thread_with_request_count (pthread_t, string, uint32_t num_requests);
|
||||
|
||||
bool caller_is_gui_thread () {
|
||||
return pthread_equal (gui_thread, pthread_self());
|
||||
|
|
|
@ -18,6 +18,7 @@ pathscanner.cc
|
|||
pool.cc
|
||||
pthread_utils.cc
|
||||
receiver.cc
|
||||
stacktrace.cc
|
||||
strsplit.cc
|
||||
textreceiver.cc
|
||||
transmitter.cc
|
||||
|
@ -31,6 +32,8 @@ xml++.cc
|
|||
conf = Configure(pbd3)
|
||||
if conf.CheckFunc('getmntent'):
|
||||
conf.env.Append(CCFLAGS="-DHAVE_GETMNTENT")
|
||||
if conf.CheckCHeader('execinfo.h'):
|
||||
conf.env.Append(CXXFLAGS="-DHAVE_EXECINFO")
|
||||
pbd3 = conf.Finish()
|
||||
|
||||
pbd3.Merge ([ libraries['sigc2'], libraries['xml'] ])
|
||||
|
|
|
@ -16,6 +16,7 @@ std::string pthread_name ();
|
|||
|
||||
namespace PBD {
|
||||
extern sigc::signal<void,pthread_t,std::string> ThreadCreated;
|
||||
extern sigc::signal<void,pthread_t,std::string,uint32_t> ThreadCreatedWithRequestSize;
|
||||
}
|
||||
|
||||
#endif /* __pbd_pthread_utils__ */
|
||||
|
|
10
libs/pbd3/pbd/stacktrace.h
Normal file
10
libs/pbd3/pbd/stacktrace.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef __libpbd_stacktrace_h__
|
||||
#define __libpbd_stacktrace_h__
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace PBD {
|
||||
void stacktrace (std::ostream& out);
|
||||
}
|
||||
|
||||
#endif /* __libpbd_stacktrace_h__ */
|
|
@ -21,6 +21,7 @@
|
|||
#include <map>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <pbd/pthread_utils.h>
|
||||
|
||||
|
@ -34,6 +35,7 @@ static pthread_mutex_t thread_map_lock = PTHREAD_MUTEX_INITIALIZER;
|
|||
|
||||
namespace PBD {
|
||||
sigc::signal<void,pthread_t,std::string> ThreadCreated;
|
||||
sigc::signal<void,pthread_t,std::string,uint32_t> ThreadCreatedWithRequestSize;
|
||||
}
|
||||
|
||||
using namespace PBD;
|
||||
|
|
42
libs/pbd3/stacktrace.cc
Normal file
42
libs/pbd3/stacktrace.cc
Normal file
|
@ -0,0 +1,42 @@
|
|||
#include <pbd/stacktrace.h>
|
||||
#include <iostream>
|
||||
|
||||
/* Obtain a backtrace and print it to stdout. */
|
||||
|
||||
#ifdef HAVE_EXECINFO
|
||||
|
||||
#include <execinfo.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void
|
||||
PBD::stacktrace (std::ostream& out)
|
||||
{
|
||||
void *array[200];
|
||||
size_t size;
|
||||
char **strings;
|
||||
size_t i;
|
||||
|
||||
size = backtrace (array, 200);
|
||||
strings = backtrace_symbols (array, size);
|
||||
|
||||
if (strings) {
|
||||
|
||||
printf ("Obtained %zd stack frames.\n", size);
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
out << strings[i] << std::endl;
|
||||
}
|
||||
|
||||
free (strings);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void
|
||||
PBD::stacktrace (std::ostream& out)
|
||||
{
|
||||
out << "stack tracing is not enabled on this platform" << std::endl;
|
||||
}
|
||||
|
||||
#endif /* HAVE_EXECINFO */
|
Loading…
Reference in New Issue
Block a user