add very simple (but already exposing many problems) wxIPC benchmark
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56360 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
fa8825a01d
commit
65669e3152
@ -39,19 +39,33 @@
|
||||
#include "wx/datetime.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxWin macros
|
||||
// local classes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// a simple connection class testing and logging various operations
|
||||
class MyConnection : public MyConnectionBase, public wxTimer
|
||||
{
|
||||
public:
|
||||
virtual bool Disconnect() { return wxConnection::Disconnect(); }
|
||||
virtual bool OnExecute(const wxString& topic, const void *data, size_t size, wxIPCFormat format);
|
||||
virtual const void *OnRequest(const wxString& topic, const wxString& item, size_t *size, wxIPCFormat format);
|
||||
virtual bool OnPoke(const wxString& topic, const wxString& item, const void *data, size_t size, wxIPCFormat format);
|
||||
virtual bool OnExecute(const wxString& topic,
|
||||
const void *data,
|
||||
size_t size,
|
||||
wxIPCFormat format);
|
||||
virtual const void *OnRequest(const wxString& topic,
|
||||
const wxString& item,
|
||||
size_t *size,
|
||||
wxIPCFormat format);
|
||||
virtual bool OnPoke(const wxString& topic,
|
||||
const wxString& item,
|
||||
const void *data,
|
||||
size_t size,
|
||||
wxIPCFormat format);
|
||||
virtual bool OnStartAdvise(const wxString& topic, const wxString& item);
|
||||
virtual bool OnStopAdvise(const wxString& topic, const wxString& item);
|
||||
virtual bool DoAdvise(const wxString& item, const void *data, size_t size, wxIPCFormat format);
|
||||
virtual bool DoAdvise(const wxString& item,
|
||||
const void *data,
|
||||
size_t size,
|
||||
wxIPCFormat format);
|
||||
virtual bool OnDisconnect();
|
||||
virtual void Notify();
|
||||
|
||||
@ -62,6 +76,38 @@ private:
|
||||
char m_achRequestBytes[3];
|
||||
};
|
||||
|
||||
// a connection used for benchmarking some IPC operations by
|
||||
// tests/benchmarks/ipcclient.cpp
|
||||
class BenchConnection : public wxConnection
|
||||
{
|
||||
public:
|
||||
BenchConnection() { m_advise = false; }
|
||||
|
||||
virtual bool OnPoke(const wxString& topic,
|
||||
const wxString& item,
|
||||
const void *data,
|
||||
size_t size,
|
||||
wxIPCFormat format);
|
||||
virtual bool OnStartAdvise(const wxString& topic, const wxString& item);
|
||||
virtual bool OnStopAdvise(const wxString& topic, const wxString& item);
|
||||
|
||||
private:
|
||||
// return true if this is the supported topic+item combination, log an
|
||||
// error message otherwise
|
||||
bool IsSupportedTopicAndItem(const wxString& operation,
|
||||
const wxString& topic,
|
||||
const wxString& item) const;
|
||||
|
||||
// the item which can be manipulated by the client via Poke() calls
|
||||
wxString m_item;
|
||||
|
||||
// should we notify the client about changes to m_item?
|
||||
bool m_advise;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(BenchConnection)
|
||||
};
|
||||
|
||||
// a simple server accepting connections to IPC_TOPIC and IPC_BENCHMARK_TOPIC
|
||||
class MyServer : public wxServer
|
||||
{
|
||||
public:
|
||||
@ -140,22 +186,29 @@ MyServer::~MyServer()
|
||||
|
||||
wxConnectionBase *MyServer::OnAcceptConnection(const wxString& topic)
|
||||
{
|
||||
wxLogMessage("OnAcceptConnection(\"%s\")", topic.c_str());
|
||||
wxLogMessage("OnAcceptConnection(\"%s\")", topic);
|
||||
|
||||
if ( topic == IPC_TOPIC )
|
||||
{
|
||||
m_connection = new MyConnection;
|
||||
wxLogMessage("Connection accepted");
|
||||
return m_connection;
|
||||
}
|
||||
else if ( topic == IPC_BENCHMARK_TOPIC )
|
||||
{
|
||||
m_connection = new BenchConnection;
|
||||
}
|
||||
else // unknown topic
|
||||
{
|
||||
wxLogMessage("Unknown topic");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// unknown topic
|
||||
return NULL;
|
||||
wxLogMessage("Connection accepted");
|
||||
return m_connection;
|
||||
}
|
||||
|
||||
void MyServer::Disconnect()
|
||||
{
|
||||
if (m_connection)
|
||||
if ( m_connection )
|
||||
{
|
||||
m_connection->Disconnect();
|
||||
delete m_connection;
|
||||
@ -204,14 +257,17 @@ MyConnection::OnRequest(const wxString& topic,
|
||||
}
|
||||
else if (item == "Date+len")
|
||||
{
|
||||
m_sRequestDate = wxDateTime::Now().FormatTime() + " " + wxDateTime::Now().FormatDate();
|
||||
m_sRequestDate = wxDateTime::Now().FormatTime() +
|
||||
" " + wxDateTime::Now().FormatDate();
|
||||
data = m_sRequestDate.c_str();
|
||||
*size = m_sRequestDate.Length() + 1;
|
||||
}
|
||||
else if (item == "bytes[3]")
|
||||
{
|
||||
data = m_achRequestBytes;
|
||||
m_achRequestBytes[0] = '1'; m_achRequestBytes[1] = '2'; m_achRequestBytes[2] = '3';
|
||||
m_achRequestBytes[0] = '1';
|
||||
m_achRequestBytes[1] = '2';
|
||||
m_achRequestBytes[2] = '3';
|
||||
*size = 3;
|
||||
}
|
||||
else
|
||||
@ -225,7 +281,7 @@ MyConnection::OnRequest(const wxString& topic,
|
||||
|
||||
bool MyConnection::OnStartAdvise(const wxString& topic, const wxString& item)
|
||||
{
|
||||
wxLogMessage("OnStartAdvise(\"%s\",\"%s\")", topic.c_str(), item.c_str());
|
||||
wxLogMessage("OnStartAdvise(\"%s\",\"%s\")", topic, item);
|
||||
wxLogMessage("Returning true");
|
||||
m_sAdvise = item;
|
||||
Start(3000); // schedule our Notify() to be called in 3 seconds
|
||||
@ -234,7 +290,7 @@ bool MyConnection::OnStartAdvise(const wxString& topic, const wxString& item)
|
||||
|
||||
bool MyConnection::OnStopAdvise(const wxString& topic, const wxString& item)
|
||||
{
|
||||
wxLogMessage("OnStopAdvise(\"%s\",\"%s\")", topic.c_str(), item.c_str());
|
||||
wxLogMessage("OnStopAdvise(\"%s\",\"%s\")", topic, item);
|
||||
wxLogMessage("Returning true");
|
||||
m_sAdvise.clear();
|
||||
Stop();
|
||||
@ -247,7 +303,8 @@ void MyConnection::Notify()
|
||||
{
|
||||
wxString s = wxDateTime::Now().Format();
|
||||
Advise(m_sAdvise, s);
|
||||
s = wxDateTime::Now().FormatTime() + " " + wxDateTime::Now().FormatDate();
|
||||
s = wxDateTime::Now().FormatTime() + " "
|
||||
+ wxDateTime::Now().FormatDate();
|
||||
Advise(m_sAdvise, s.mb_str(), s.length() + 1);
|
||||
|
||||
#if wxUSE_DDE_FOR_IPC
|
||||
@ -265,7 +322,10 @@ void MyConnection::Notify()
|
||||
}
|
||||
}
|
||||
|
||||
bool MyConnection::DoAdvise(const wxString& item, const void *data, size_t size, wxIPCFormat format)
|
||||
bool MyConnection::DoAdvise(const wxString& item,
|
||||
const void *data,
|
||||
size_t size,
|
||||
wxIPCFormat format)
|
||||
{
|
||||
Log("Advise", "", item, data, size, format);
|
||||
return wxConnection::DoAdvise(item, data, size, format);
|
||||
@ -276,3 +336,69 @@ bool MyConnection::OnDisconnect()
|
||||
wxLogMessage("OnDisconnect()");
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// BenchConnection
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool BenchConnection::IsSupportedTopicAndItem(const wxString& operation,
|
||||
const wxString& topic,
|
||||
const wxString& item) const
|
||||
{
|
||||
if ( topic != IPC_BENCHMARK_TOPIC ||
|
||||
item != IPC_BENCHMARK_ITEM )
|
||||
{
|
||||
wxLogMessage("Unexpected %s(\"%s\", \"%s\") call.",
|
||||
operation, topic, item);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BenchConnection::OnPoke(const wxString& topic,
|
||||
const wxString& item,
|
||||
const void *data,
|
||||
size_t size,
|
||||
wxIPCFormat format)
|
||||
{
|
||||
if ( !IsSupportedTopicAndItem("OnPoke", topic, item) )
|
||||
return false;
|
||||
|
||||
if ( !IsTextFormat(format) )
|
||||
{
|
||||
wxLogMessage("Unexpected format %d in OnPoke().", format);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_item = GetTextFromData(data, size, format);
|
||||
|
||||
if ( m_advise )
|
||||
{
|
||||
if ( !Advise(item, m_item) )
|
||||
wxLogMessage("Failed to advise client about the change.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BenchConnection::OnStartAdvise(const wxString& topic, const wxString& item)
|
||||
{
|
||||
if ( !IsSupportedTopicAndItem("OnStartAdvise", topic, item) )
|
||||
return false;
|
||||
|
||||
m_advise = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BenchConnection::OnStopAdvise(const wxString& topic, const wxString& item)
|
||||
{
|
||||
if ( !IsSupportedTopicAndItem("OnStopAdvise", topic, item) )
|
||||
return false;
|
||||
|
||||
m_advise = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -15,14 +15,19 @@
|
||||
#include "wx/ipc.h"
|
||||
|
||||
// the default service name
|
||||
#define IPC_SERVICE _T("4242")
|
||||
#define IPC_SERVICE "4242"
|
||||
//#define IPC_SERVICE _T("/tmp/wxsrv424")
|
||||
|
||||
// the hostname
|
||||
#define IPC_HOST _T("localhost")
|
||||
#define IPC_HOST "localhost"
|
||||
|
||||
// the IPC topic
|
||||
#define IPC_TOPIC _T("IPC TEST")
|
||||
#define IPC_TOPIC "IPC TEST"
|
||||
|
||||
// the name of the item we're being advised about
|
||||
#define IPC_ADVISE_NAME _T("Item")
|
||||
#define IPC_ADVISE_NAME "Item"
|
||||
|
||||
|
||||
// the values used by tests/benchmarks/ipcclient.cpp
|
||||
#define IPC_BENCHMARK_TOPIC "wxIPC BENCH"
|
||||
#define IPC_BENCHMARK_ITEM "Benchmark"
|
||||
|
@ -46,6 +46,7 @@ BENCH_OBJECTS = \
|
||||
bench_bench.o \
|
||||
bench_htmlpars.o \
|
||||
bench_htmltag.o \
|
||||
bench_ipcclient.o \
|
||||
bench_strings.o \
|
||||
bench_tls.o
|
||||
|
||||
@ -73,6 +74,9 @@ BENCH_OBJECTS = \
|
||||
COND_MONOLITHIC_0___WXLIB_BASE_p = \
|
||||
-lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_MONOLITHIC_0@__WXLIB_BASE_p = $(COND_MONOLITHIC_0___WXLIB_BASE_p)
|
||||
COND_MONOLITHIC_0___WXLIB_NET_p = \
|
||||
-lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_MONOLITHIC_0@__WXLIB_NET_p = $(COND_MONOLITHIC_0___WXLIB_NET_p)
|
||||
COND_MONOLITHIC_1___WXLIB_MONO_p = \
|
||||
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_MONOLITHIC_1@__WXLIB_MONO_p = $(COND_MONOLITHIC_1___WXLIB_MONO_p)
|
||||
@ -103,7 +107,7 @@ distclean: clean
|
||||
rm -f config.cache config.log config.status bk-deps bk-make-pch shared-ld-sh Makefile
|
||||
|
||||
bench$(EXEEXT): $(BENCH_OBJECTS)
|
||||
$(CXX) -o $@ $(BENCH_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
|
||||
$(CXX) -o $@ $(BENCH_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(__WXLIB_BASE_p) $(__WXLIB_NET_p) $(__WXLIB_MONO_p) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
|
||||
|
||||
$(__bench___mac_setfilecmd)
|
||||
$(SAMPLES_RPATH_POSTLINK)
|
||||
@ -129,6 +133,9 @@ bench_htmlpars.o: $(srcdir)/htmlparser/htmlpars.cpp
|
||||
bench_htmltag.o: $(srcdir)/htmlparser/htmltag.cpp
|
||||
$(CXXC) -c -o $@ $(BENCH_CXXFLAGS) $(srcdir)/htmlparser/htmltag.cpp
|
||||
|
||||
bench_ipcclient.o: $(srcdir)/ipcclient.cpp
|
||||
$(CXXC) -c -o $@ $(BENCH_CXXFLAGS) $(srcdir)/ipcclient.cpp
|
||||
|
||||
bench_strings.o: $(srcdir)/strings.cpp
|
||||
$(CXXC) -c -o $@ $(BENCH_CXXFLAGS) $(srcdir)/strings.cpp
|
||||
|
||||
|
@ -13,10 +13,12 @@
|
||||
bench.cpp
|
||||
htmlparser/htmlpars.cpp
|
||||
htmlparser/htmltag.cpp
|
||||
ipcclient.cpp
|
||||
strings.cpp
|
||||
tls.cpp
|
||||
</sources>
|
||||
<wx-lib>base</wx-lib>
|
||||
<wx-lib>net</wx-lib>
|
||||
</exe>
|
||||
|
||||
<wx-data id="data">
|
||||
|
@ -54,8 +54,8 @@ BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivudll\bench.exe" /debug /pdb:"vc_mswunivudll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
|
||||
# ADD LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivudll\bench.exe" /debug /pdb:"vc_mswunivudll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
|
||||
# ADD BASE LINK32 wxbase29u.lib wxbase29u_net.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivudll\bench.exe" /debug /pdb:"vc_mswunivudll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
|
||||
# ADD LINK32 wxbase29u.lib wxbase29u_net.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivudll\bench.exe" /debug /pdb:"vc_mswunivudll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
|
||||
|
||||
!ELSEIF "$(CFG)" == "bench - Win32 DLL Universal Debug"
|
||||
|
||||
@ -77,8 +77,8 @@ BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivuddll\bench.exe" /debug /pdb:"vc_mswunivuddll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
|
||||
# ADD LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivuddll\bench.exe" /debug /pdb:"vc_mswunivuddll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
|
||||
# ADD BASE LINK32 wxbase29ud.lib wxbase29ud_net.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivuddll\bench.exe" /debug /pdb:"vc_mswunivuddll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
|
||||
# ADD LINK32 wxbase29ud.lib wxbase29ud_net.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivuddll\bench.exe" /debug /pdb:"vc_mswunivuddll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
|
||||
|
||||
!ELSEIF "$(CFG)" == "bench - Win32 DLL Release"
|
||||
|
||||
@ -100,8 +100,8 @@ BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswudll\bench.exe" /debug /pdb:"vc_mswudll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
|
||||
# ADD LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswudll\bench.exe" /debug /pdb:"vc_mswudll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
|
||||
# ADD BASE LINK32 wxbase29u.lib wxbase29u_net.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswudll\bench.exe" /debug /pdb:"vc_mswudll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
|
||||
# ADD LINK32 wxbase29u.lib wxbase29u_net.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswudll\bench.exe" /debug /pdb:"vc_mswudll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
|
||||
|
||||
!ELSEIF "$(CFG)" == "bench - Win32 DLL Debug"
|
||||
|
||||
@ -123,8 +123,8 @@ BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswuddll\bench.exe" /debug /pdb:"vc_mswuddll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
|
||||
# ADD LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswuddll\bench.exe" /debug /pdb:"vc_mswuddll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
|
||||
# ADD BASE LINK32 wxbase29ud.lib wxbase29ud_net.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswuddll\bench.exe" /debug /pdb:"vc_mswuddll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
|
||||
# ADD LINK32 wxbase29ud.lib wxbase29ud_net.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswuddll\bench.exe" /debug /pdb:"vc_mswuddll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
|
||||
|
||||
!ELSEIF "$(CFG)" == "bench - Win32 Universal Release"
|
||||
|
||||
@ -146,8 +146,8 @@ BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivu\bench.exe" /debug /pdb:"vc_mswunivu\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
|
||||
# ADD LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivu\bench.exe" /debug /pdb:"vc_mswunivu\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
|
||||
# ADD BASE LINK32 wxbase29u.lib wxbase29u_net.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivu\bench.exe" /debug /pdb:"vc_mswunivu\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
|
||||
# ADD LINK32 wxbase29u.lib wxbase29u_net.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivu\bench.exe" /debug /pdb:"vc_mswunivu\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
|
||||
|
||||
!ELSEIF "$(CFG)" == "bench - Win32 Universal Debug"
|
||||
|
||||
@ -169,8 +169,8 @@ BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivud\bench.exe" /debug /pdb:"vc_mswunivud\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
|
||||
# ADD LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivud\bench.exe" /debug /pdb:"vc_mswunivud\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
|
||||
# ADD BASE LINK32 wxbase29ud.lib wxbase29ud_net.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivud\bench.exe" /debug /pdb:"vc_mswunivud\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
|
||||
# ADD LINK32 wxbase29ud.lib wxbase29ud_net.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivud\bench.exe" /debug /pdb:"vc_mswunivud\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
|
||||
|
||||
!ELSEIF "$(CFG)" == "bench - Win32 Release"
|
||||
|
||||
@ -192,8 +192,8 @@ BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswu\bench.exe" /debug /pdb:"vc_mswu\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
|
||||
# ADD LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswu\bench.exe" /debug /pdb:"vc_mswu\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
|
||||
# ADD BASE LINK32 wxbase29u.lib wxbase29u_net.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswu\bench.exe" /debug /pdb:"vc_mswu\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
|
||||
# ADD LINK32 wxbase29u.lib wxbase29u_net.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswu\bench.exe" /debug /pdb:"vc_mswu\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
|
||||
|
||||
!ELSEIF "$(CFG)" == "bench - Win32 Debug"
|
||||
|
||||
@ -215,8 +215,8 @@ BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswud\bench.exe" /debug /pdb:"vc_mswud\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
|
||||
# ADD LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswud\bench.exe" /debug /pdb:"vc_mswud\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
|
||||
# ADD BASE LINK32 wxbase29ud.lib wxbase29ud_net.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswud\bench.exe" /debug /pdb:"vc_mswud\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
|
||||
# ADD LINK32 wxbase29ud.lib wxbase29ud_net.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswud\bench.exe" /debug /pdb:"vc_mswud\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
|
||||
|
||||
!ENDIF
|
||||
|
||||
@ -247,6 +247,10 @@ SOURCE=.\htmlparser\htmltag.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ipcclient.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\strings.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -13,6 +13,9 @@ Package=<4>
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name base
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name net
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
@ -29,3 +32,15 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "net"=..\..\build\msw\wx_net.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=""
|
||||
AdditionalDependencies="wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
|
||||
AdditionalDependencies="wxbase29u.lib wxbase29u_net.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
|
||||
OutputFile="vc_mswunivudll\bench.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
@ -108,7 +108,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=""
|
||||
AdditionalDependencies="wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
|
||||
AdditionalDependencies="wxbase29ud.lib wxbase29ud_net.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
|
||||
OutputFile="vc_mswunivuddll\bench.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
@ -169,7 +169,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=""
|
||||
AdditionalDependencies="wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
|
||||
AdditionalDependencies="wxbase29u.lib wxbase29u_net.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
|
||||
OutputFile="vc_mswudll\bench.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
@ -233,7 +233,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=""
|
||||
AdditionalDependencies="wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
|
||||
AdditionalDependencies="wxbase29ud.lib wxbase29ud_net.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
|
||||
OutputFile="vc_mswuddll\bench.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
@ -294,7 +294,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=""
|
||||
AdditionalDependencies="wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
|
||||
AdditionalDependencies="wxbase29u.lib wxbase29u_net.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
|
||||
OutputFile="vc_mswunivu\bench.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
@ -358,7 +358,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=""
|
||||
AdditionalDependencies="wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
|
||||
AdditionalDependencies="wxbase29ud.lib wxbase29ud_net.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
|
||||
OutputFile="vc_mswunivud\bench.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
@ -419,7 +419,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=""
|
||||
AdditionalDependencies="wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
|
||||
AdditionalDependencies="wxbase29u.lib wxbase29u_net.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
|
||||
OutputFile="vc_mswu\bench.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
@ -483,7 +483,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=""
|
||||
AdditionalDependencies="wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
|
||||
AdditionalDependencies="wxbase29ud.lib wxbase29ud_net.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
|
||||
OutputFile="vc_mswud\bench.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
@ -534,6 +534,9 @@
|
||||
<File
|
||||
RelativePath=".\htmlparser\htmltag.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ipcclient.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\strings.cpp">
|
||||
</File>
|
||||
|
169
tests/benchmarks/ipcclient.cpp
Normal file
169
tests/benchmarks/ipcclient.cpp
Normal file
@ -0,0 +1,169 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: tests/benchmarks/ipcclient.cpp
|
||||
// Purpose: wxIPC client side benchmarks
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2008-10-13
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "bench.h"
|
||||
|
||||
#include "wx/evtloop.h"
|
||||
|
||||
#include "wx/ipc.h"
|
||||
#include "../../samples/ipc/ipcsetup.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
class PokeAdviseConn : public wxConnection
|
||||
{
|
||||
public:
|
||||
PokeAdviseConn() { m_gotAdvised = false; }
|
||||
|
||||
bool GotAdvised()
|
||||
{
|
||||
if ( !m_gotAdvised )
|
||||
return false;
|
||||
|
||||
m_gotAdvised = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const wxString& GetItem() const { return m_item; }
|
||||
|
||||
virtual bool OnAdvise(const wxString& topic,
|
||||
const wxString& item,
|
||||
const void *data,
|
||||
size_t size,
|
||||
wxIPCFormat format)
|
||||
{
|
||||
m_gotAdvised = true;
|
||||
|
||||
if ( topic != IPC_BENCHMARK_TOPIC ||
|
||||
item != IPC_BENCHMARK_ITEM ||
|
||||
!IsTextFormat(format) )
|
||||
{
|
||||
m_item = "ERROR";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_item = GetTextFromData(data, size, format);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
wxString m_item;
|
||||
bool m_gotAdvised;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(PokeAdviseConn)
|
||||
};
|
||||
|
||||
class PokeAdviseClient : public wxClient
|
||||
{
|
||||
public:
|
||||
// provide a convenient helper taking care of connecting to the right
|
||||
// server/service/topic and returning the connection of the derived type
|
||||
// (or NULL if we failed to connect)
|
||||
PokeAdviseConn *Connect()
|
||||
{
|
||||
wxString host = Bench::GetStringParameter();
|
||||
if ( host.empty() )
|
||||
host = IPC_HOST;
|
||||
|
||||
wxString service;
|
||||
int port = Bench::GetNumericParameter();
|
||||
if ( !port )
|
||||
service = IPC_SERVICE;
|
||||
else
|
||||
service.Printf("%d", port);
|
||||
|
||||
return static_cast<PokeAdviseConn *>(
|
||||
MakeConnection(host, service, IPC_BENCHMARK_TOPIC));
|
||||
}
|
||||
|
||||
|
||||
// override base class virtual to use a custom connection class
|
||||
virtual wxConnectionBase *OnMakeConnection()
|
||||
{
|
||||
return new PokeAdviseConn;
|
||||
}
|
||||
};
|
||||
|
||||
class PokeAdvisePersistentConnection
|
||||
{
|
||||
public:
|
||||
PokeAdvisePersistentConnection()
|
||||
{
|
||||
m_client = new PokeAdviseClient;
|
||||
m_conn = m_client->Connect();
|
||||
if ( m_conn )
|
||||
m_conn->StartAdvise(IPC_BENCHMARK_ITEM);
|
||||
}
|
||||
|
||||
~PokeAdvisePersistentConnection()
|
||||
{
|
||||
if ( m_conn )
|
||||
{
|
||||
m_conn->StopAdvise(IPC_BENCHMARK_ITEM);
|
||||
m_conn->Disconnect();
|
||||
}
|
||||
|
||||
delete m_client;
|
||||
}
|
||||
|
||||
PokeAdviseConn *Get() const { return m_conn; }
|
||||
|
||||
private:
|
||||
PokeAdviseClient *m_client;
|
||||
PokeAdviseConn *m_conn;
|
||||
bool m_initDone;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(PokeAdvisePersistentConnection)
|
||||
};
|
||||
|
||||
PokeAdvisePersistentConnection *theConnection = NULL;
|
||||
|
||||
bool ConnInit()
|
||||
{
|
||||
theConnection = new PokeAdvisePersistentConnection;
|
||||
if ( !theConnection->Get() )
|
||||
{
|
||||
delete theConnection;
|
||||
theConnection = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ConnDone()
|
||||
{
|
||||
delete theConnection;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
BENCHMARK_FUNC_WITH_INIT(IPCPokeAdvise, ConnInit, ConnDone)
|
||||
{
|
||||
wxEventLoop loop;
|
||||
|
||||
PokeAdviseConn * const conn = theConnection->Get();
|
||||
|
||||
const wxString s(1024, '@');
|
||||
|
||||
if ( !conn->Poke(IPC_BENCHMARK_ITEM, s) )
|
||||
return false;
|
||||
|
||||
while ( !conn->GotAdvised() )
|
||||
loop.Dispatch();
|
||||
|
||||
if ( conn->GetItem() != s )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
@ -38,6 +38,7 @@ BENCH_OBJECTS = \
|
||||
$(OBJS)\bench_bench.obj \
|
||||
$(OBJS)\bench_htmlpars.obj \
|
||||
$(OBJS)\bench_htmltag.obj \
|
||||
$(OBJS)\bench_ipcclient.obj \
|
||||
$(OBJS)\bench_strings.obj \
|
||||
$(OBJS)\bench_tls.obj
|
||||
|
||||
@ -143,6 +144,10 @@ __DLLFLAG_p = -DWXUSINGDLL
|
||||
__WXLIB_BASE_p = \
|
||||
wxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
|
||||
!endif
|
||||
!if "$(MONOLITHIC)" == "0"
|
||||
__WXLIB_NET_p = \
|
||||
wxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net.lib
|
||||
!endif
|
||||
!if "$(MONOLITHIC)" == "1"
|
||||
__WXLIB_MONO_p = \
|
||||
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
|
||||
@ -188,7 +193,7 @@ clean:
|
||||
|
||||
$(OBJS)\bench.exe: $(BENCH_OBJECTS)
|
||||
ilink32 -Tpe -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO) -L$(LIBDIRNAME) -ap $(LDFLAGS) @&&|
|
||||
c0x32.obj $(BENCH_OBJECTS),$@,, $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) ole2w32.lib oleacc.lib import32.lib cw32$(__THREADSFLAG_5)$(__RUNTIME_LIBS_8).lib,,
|
||||
c0x32.obj $(BENCH_OBJECTS),$@,, $(__WXLIB_BASE_p) $(__WXLIB_NET_p) $(__WXLIB_MONO_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) ole2w32.lib oleacc.lib import32.lib cw32$(__THREADSFLAG_5)$(__RUNTIME_LIBS_8).lib,,
|
||||
|
|
||||
|
||||
data:
|
||||
@ -204,6 +209,9 @@ $(OBJS)\bench_htmlpars.obj: .\htmlparser\htmlpars.cpp
|
||||
$(OBJS)\bench_htmltag.obj: .\htmlparser\htmltag.cpp
|
||||
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\htmlparser\htmltag.cpp
|
||||
|
||||
$(OBJS)\bench_ipcclient.obj: .\ipcclient.cpp
|
||||
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\ipcclient.cpp
|
||||
|
||||
$(OBJS)\bench_strings.obj: .\strings.cpp
|
||||
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\strings.cpp
|
||||
|
||||
|
@ -31,6 +31,7 @@ BENCH_OBJECTS = \
|
||||
$(OBJS)\bench_bench.o \
|
||||
$(OBJS)\bench_htmlpars.o \
|
||||
$(OBJS)\bench_htmltag.o \
|
||||
$(OBJS)\bench_ipcclient.o \
|
||||
$(OBJS)\bench_strings.o \
|
||||
$(OBJS)\bench_tls.o
|
||||
|
||||
@ -131,6 +132,10 @@ ifeq ($(MONOLITHIC),0)
|
||||
__WXLIB_BASE_p = \
|
||||
-lwxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)
|
||||
endif
|
||||
ifeq ($(MONOLITHIC),0)
|
||||
__WXLIB_NET_p = \
|
||||
-lwxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net
|
||||
endif
|
||||
ifeq ($(MONOLITHIC),1)
|
||||
__WXLIB_MONO_p = \
|
||||
-lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)
|
||||
@ -179,7 +184,7 @@ clean:
|
||||
-if exist $(OBJS)\bench.exe del $(OBJS)\bench.exe
|
||||
|
||||
$(OBJS)\bench.exe: $(BENCH_OBJECTS)
|
||||
$(CXX) -o $@ $(BENCH_OBJECTS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(LDFLAGS) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32
|
||||
$(CXX) -o $@ $(BENCH_OBJECTS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(LDFLAGS) $(__WXLIB_BASE_p) $(__WXLIB_NET_p) $(__WXLIB_MONO_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32
|
||||
|
||||
data:
|
||||
if not exist $(OBJS) mkdir $(OBJS)
|
||||
@ -194,6 +199,9 @@ $(OBJS)\bench_htmlpars.o: ./htmlparser/htmlpars.cpp
|
||||
$(OBJS)\bench_htmltag.o: ./htmlparser/htmltag.cpp
|
||||
$(CXX) -c -o $@ $(BENCH_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\bench_ipcclient.o: ./ipcclient.cpp
|
||||
$(CXX) -c -o $@ $(BENCH_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\bench_strings.o: ./strings.cpp
|
||||
$(CXX) -c -o $@ $(BENCH_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
|
@ -32,6 +32,7 @@ BENCH_OBJECTS = \
|
||||
$(OBJS)\bench_bench.obj \
|
||||
$(OBJS)\bench_htmlpars.obj \
|
||||
$(OBJS)\bench_htmltag.obj \
|
||||
$(OBJS)\bench_ipcclient.obj \
|
||||
$(OBJS)\bench_strings.obj \
|
||||
$(OBJS)\bench_tls.obj
|
||||
|
||||
@ -215,6 +216,10 @@ __DLLFLAG_p = /DWXUSINGDLL
|
||||
__WXLIB_BASE_p = \
|
||||
wxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
|
||||
!endif
|
||||
!if "$(MONOLITHIC)" == "0"
|
||||
__WXLIB_NET_p = \
|
||||
wxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net.lib
|
||||
!endif
|
||||
!if "$(MONOLITHIC)" == "1"
|
||||
__WXLIB_MONO_p = \
|
||||
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
|
||||
@ -245,7 +250,7 @@ clean:
|
||||
|
||||
$(OBJS)\bench.exe: $(BENCH_OBJECTS)
|
||||
link /NOLOGO /OUT:$@ $(__DEBUGINFO_1) /pdb:"$(OBJS)\bench.pdb" $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:CONSOLE $(LDFLAGS) @<<
|
||||
$(BENCH_OBJECTS) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib
|
||||
$(BENCH_OBJECTS) $(__WXLIB_BASE_p) $(__WXLIB_NET_p) $(__WXLIB_MONO_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib
|
||||
<<
|
||||
|
||||
data:
|
||||
@ -261,6 +266,9 @@ $(OBJS)\bench_htmlpars.obj: .\htmlparser\htmlpars.cpp
|
||||
$(OBJS)\bench_htmltag.obj: .\htmlparser\htmltag.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(BENCH_CXXFLAGS) .\htmlparser\htmltag.cpp
|
||||
|
||||
$(OBJS)\bench_ipcclient.obj: .\ipcclient.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(BENCH_CXXFLAGS) .\ipcclient.cpp
|
||||
|
||||
$(OBJS)\bench_strings.obj: .\strings.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(BENCH_CXXFLAGS) .\strings.cpp
|
||||
|
||||
|
@ -183,6 +183,11 @@ __WXLIB_BASE_p =
|
||||
__WXLIB_BASE_p = &
|
||||
wxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
|
||||
!endif
|
||||
__WXLIB_NET_p =
|
||||
!ifeq MONOLITHIC 0
|
||||
__WXLIB_NET_p = &
|
||||
wxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net.lib
|
||||
!endif
|
||||
__WXLIB_MONO_p =
|
||||
!ifeq MONOLITHIC 1
|
||||
__WXLIB_MONO_p = &
|
||||
@ -212,6 +217,7 @@ BENCH_OBJECTS = &
|
||||
$(OBJS)\bench_bench.obj &
|
||||
$(OBJS)\bench_htmlpars.obj &
|
||||
$(OBJS)\bench_htmltag.obj &
|
||||
$(OBJS)\bench_ipcclient.obj &
|
||||
$(OBJS)\bench_strings.obj &
|
||||
$(OBJS)\bench_tls.obj
|
||||
|
||||
@ -239,7 +245,7 @@ $(OBJS)\bench.exe : $(BENCH_OBJECTS)
|
||||
@%append $(OBJS)\bench.lbc option caseexact
|
||||
@%append $(OBJS)\bench.lbc $(__DEBUGINFO_1) libpath $(LIBDIRNAME) system nt ref 'main_' $(LDFLAGS)
|
||||
@for %i in ($(BENCH_OBJECTS)) do @%append $(OBJS)\bench.lbc file %i
|
||||
@for %i in ( $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__GDIPLUS_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib) do @%append $(OBJS)\bench.lbc library %i
|
||||
@for %i in ( $(__WXLIB_BASE_p) $(__WXLIB_NET_p) $(__WXLIB_MONO_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__GDIPLUS_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib) do @%append $(OBJS)\bench.lbc library %i
|
||||
@%append $(OBJS)\bench.lbc
|
||||
@for %i in () do @%append $(OBJS)\bench.lbc option stack=%i
|
||||
wlink @$(OBJS)\bench.lbc
|
||||
@ -257,6 +263,9 @@ $(OBJS)\bench_htmlpars.obj : .AUTODEPEND .\htmlparser\htmlpars.cpp
|
||||
$(OBJS)\bench_htmltag.obj : .AUTODEPEND .\htmlparser\htmltag.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(BENCH_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\bench_ipcclient.obj : .AUTODEPEND .\ipcclient.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(BENCH_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\bench_strings.obj : .AUTODEPEND .\strings.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(BENCH_CXXFLAGS) $<
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user