linux fix
This commit is contained in:
@@ -817,7 +817,7 @@ bool PITerminal::initialize() {
|
|||||||
memcpy(argv[0], shell.data(), shell.size());
|
memcpy(argv[0], shell.data(), shell.size());
|
||||||
argv[0][shell.size()] = 0;
|
argv[0][shell.size()] = 0;
|
||||||
argv[1] = 0;
|
argv[1] = 0;
|
||||||
execvp(shell.data(), argv);
|
execvp(argv[0], argv);
|
||||||
delete[] argv[0];
|
delete[] argv[0];
|
||||||
delete[] argv;
|
delete[] argv;
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ void PIProcess::startProc(bool detached) {
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
//cout << "exec " << tf_in << ", " << tf_out << ", " << tf_err << endl;
|
//cout << "exec " << tf_in << ", " << tf_out << ", " << tf_err << endl;
|
||||||
if (execve(str.data(), argscc, envcc) < 0)
|
if (execve(str.data(), (char * const *)argscc, (char * const *)envcc) < 0)
|
||||||
piCoutObj << "\"execve" << str << args << "\" error :" << errorString();
|
piCoutObj << "\"execve" << str << args << "\" error :" << errorString();
|
||||||
} else {
|
} else {
|
||||||
piMinSleep;
|
piMinSleep;
|
||||||
|
|||||||
185
main.cpp
185
main.cpp
@@ -1,89 +1,114 @@
|
|||||||
#include "pip.h"
|
#include "pip.h"
|
||||||
|
|
||||||
REGISTER_VARIANT_TYPEINFO(PIVector<double>)
|
static const char * smallstr = "abcdef";
|
||||||
|
|
||||||
PIEthernet eth;
|
static const char * bigstr = "zsxdcgfhvbncjdbasljcvavcjadnwnxudvbabdhjlavudvdaljsvclavjlasdhvcjhldsavhjldasvfjlhsavdjhavdjhvfjhldasvfjlasvfhjldasvfhjasvfdjdasfhvjldasvhfjlasvfhjlahsvdfhjfvfvdjalsvfjlhasdvfdjsalvfhhjldasvfdjhaldsvfhjdvsfjhlavfjhlavfladlsvfjlasdvfdhjlavfhjldasvfhjlavfhjldvfhjlalsdvfjlhvasfhjlvchjlavchjladvchjldladvschjlladscvjlhdcahjchjllcahjllvcdjladsvhldbcljadsbcjdhlsachjlvdsa hjlcldajc hljdascbhaldb cldhashd l cajlhs chdsbfhlbfdasdffadsfjkbfkjldsabflhbcldhsbhclabchljadsbchldahsbcladsbhclhabhasbclasbdhl";
|
||||||
|
|
||||||
class OH: public PIObject {
|
|
||||||
PIOBJECT(OH)
|
|
||||||
public:
|
|
||||||
EVENT_HANDLER0(void, eh0) {
|
|
||||||
piCout << "eh0";
|
|
||||||
}
|
|
||||||
EVENT_HANDLER1(void, eh1, PIStringList, sl) {
|
|
||||||
piCout << "eh1" << sl;
|
|
||||||
}
|
|
||||||
EVENT_HANDLER2(void, eh2, PIStringList, sl, const PIVector< double > &, vd) {
|
|
||||||
piCout << "eh2" << sl << vd;
|
|
||||||
}
|
|
||||||
EVENT_HANDLER3(void, eh3, PIStringList, sl, const PIVector<double> &, vd, PISystemTime, st) {
|
|
||||||
piCout << "eh3" << sl << vd << st;
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
int cnt = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class OE: public PIThread {
|
|
||||||
PIOBJECT_SUBCLASS(OE, PIThread)
|
|
||||||
public:
|
|
||||||
EVENT0(e0);
|
|
||||||
EVENT1(e1, PIStringList, sl);
|
|
||||||
EVENT2(e2, PIStringList, sl, PIVector< double>, vd);
|
|
||||||
EVENT3(e3, PIStringList, sl, PIVector< double>, vd, PISystemTime, st);
|
|
||||||
private:
|
|
||||||
};
|
|
||||||
|
|
||||||
PIThreadNotifier notifier;
|
|
||||||
PITimeMeasurer time;
|
|
||||||
|
|
||||||
class Worker: public PIThread {
|
|
||||||
PIOBJECT_SUBCLASS(Worker, PIThread)
|
|
||||||
public:
|
|
||||||
Worker(const PIString & n) {
|
|
||||||
setName(n);
|
|
||||||
}
|
|
||||||
void run() override {
|
|
||||||
piCoutObj << (int)time.elapsed_m() << "wait ...";
|
|
||||||
notifier.wait();
|
|
||||||
piCoutObj << (int)time.elapsed_m() << "done";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
typedef int(*MyFunc)(int,int);
|
static const int cc = 1000000;
|
||||||
PILibrary * lib = new PILibrary();
|
PITimeMeasurer tm;
|
||||||
if (lib->load("libpip_plugin.dll")) {
|
int l = 0;
|
||||||
MyFunc fadd = (MyFunc)lib->resolve("exportedSum");
|
tm.reset();
|
||||||
MyFunc fmul = (MyFunc)lib->resolve("exportedMul");
|
for(int i=0; i<cc; ++i) {
|
||||||
if (fadd) {
|
PIString s(smallstr);
|
||||||
int sum = fadd(1, 2);
|
l = s.size();
|
||||||
piCout << "sum =" << sum;
|
|
||||||
} else {
|
|
||||||
piCout << "Can`t resolve" << "exportedSum";
|
|
||||||
}
|
|
||||||
if (fmul) {
|
|
||||||
int mul = fadd(10, 20);
|
|
||||||
piCout << "mul =" << mul;
|
|
||||||
} else {
|
|
||||||
piCout << "Can`t resolve" << "exportedMul";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
piCout << lib->lastError();
|
|
||||||
}
|
}
|
||||||
delete lib;
|
piCout << l << "PIString()" << tm.elapsed_m();
|
||||||
/*OH oh;
|
tm.reset();
|
||||||
OE oe;
|
for(int i=0; i<cc; ++i) {
|
||||||
CONNECTU(&oe, e3, &oh, eh0);
|
PIString s = smallstr;
|
||||||
CONNECTU(&oe, e3, &oh, eh1);
|
l = s.size();
|
||||||
CONNECTU(&oe, e3, &oh, eh2);
|
}
|
||||||
CONNECTU(&oe, e3, &oh, eh3);
|
piCout << l << "PIString =" << tm.elapsed_m();
|
||||||
//oh.dump();
|
tm.reset();
|
||||||
oe.dump();
|
for(int i=0; i<cc; ++i) {
|
||||||
oe.e0();
|
PIString s = PIStringAscii(smallstr);
|
||||||
oe.e1({"a", "b", "c"});
|
l = s.size();
|
||||||
oe.e2({"a", "b", "c"}, {1., 1.5, 2.});
|
}
|
||||||
oe.e3({"a", "b", "c"}, {1., 1.5, 2.}, PISystemTime::current());
|
piCout << l << "PIStringAscii" << tm.elapsed_m();
|
||||||
//piCout << oe.methodsEH();*/
|
tm.reset();
|
||||||
|
for(int i=0; i<cc; ++i) {
|
||||||
|
PIString s;
|
||||||
|
s += smallstr;
|
||||||
|
s += "1";
|
||||||
|
l = s.size();
|
||||||
|
}
|
||||||
|
piCout << l << "PIString + PIString" << tm.elapsed_m();
|
||||||
|
tm.reset();
|
||||||
|
for(int i=0; i<cc; ++i) {
|
||||||
|
PIString s = PIStringAscii(smallstr) + "1";
|
||||||
|
l = s.size();
|
||||||
|
}
|
||||||
|
piCout << l << "PIStringAscii + PIString" << tm.elapsed_m();
|
||||||
|
tm.reset();
|
||||||
|
for(int i=0; i<cc; ++i) {
|
||||||
|
PIString s = PIString::fromUTF8(smallstr);
|
||||||
|
l = s.size();
|
||||||
|
}
|
||||||
|
piCout << l << "PIString::fromUTF8" << tm.elapsed_m();
|
||||||
|
tm.reset();
|
||||||
|
for(int i=0; i<cc; ++i) {
|
||||||
|
PIString s = PIString::fromSystem(smallstr);
|
||||||
|
l = s.size();
|
||||||
|
}
|
||||||
|
piCout << l << "PIString::fromSystem" << tm.elapsed_m();
|
||||||
|
tm.reset();
|
||||||
|
for(int i=0; i<cc; ++i) {
|
||||||
|
PIString s = PIString::fromAscii(smallstr);
|
||||||
|
l = s.size();
|
||||||
|
}
|
||||||
|
piCout << l << "PIString::fromAscii" << tm.elapsed_m();
|
||||||
|
|
||||||
|
tm.reset();
|
||||||
|
for(int i=0; i<cc; ++i) {
|
||||||
|
PIString s(bigstr);
|
||||||
|
l = s.size();
|
||||||
|
}
|
||||||
|
piCout << l << "PIString()" << tm.elapsed_m();
|
||||||
|
tm.reset();
|
||||||
|
for(int i=0; i<cc; ++i) {
|
||||||
|
PIString s = bigstr;
|
||||||
|
l = s.size();
|
||||||
|
}
|
||||||
|
piCout << l << "PIString =" << tm.elapsed_m();
|
||||||
|
tm.reset();
|
||||||
|
for(int i=0; i<cc; ++i) {
|
||||||
|
PIString s = PIStringAscii(bigstr);
|
||||||
|
l = s.size();
|
||||||
|
}
|
||||||
|
piCout << l << "PIStringAscii" << tm.elapsed_m();
|
||||||
|
tm.reset();
|
||||||
|
for(int i=0; i<cc; ++i) {
|
||||||
|
PIString s;
|
||||||
|
s += bigstr;
|
||||||
|
s += "1";
|
||||||
|
l = s.size();
|
||||||
|
}
|
||||||
|
piCout << l << "PIString + PIString" << tm.elapsed_m();
|
||||||
|
tm.reset();
|
||||||
|
for(int i=0; i<cc; ++i) {
|
||||||
|
PIString s = PIStringAscii(bigstr) + "1";
|
||||||
|
l = s.size();
|
||||||
|
}
|
||||||
|
piCout << l << "PIStringAscii + PIString" << tm.elapsed_m();
|
||||||
|
tm.reset();
|
||||||
|
for(int i=0; i<cc; ++i) {
|
||||||
|
PIString s = PIString::fromUTF8(bigstr);
|
||||||
|
l = s.size();
|
||||||
|
}
|
||||||
|
piCout << l << "PIString::fromUTF8" << tm.elapsed_m();
|
||||||
|
tm.reset();
|
||||||
|
for(int i=0; i<cc; ++i) {
|
||||||
|
PIString s = PIString::fromSystem(bigstr);
|
||||||
|
l = s.size();
|
||||||
|
}
|
||||||
|
piCout << l << "PIString::fromSystem" << tm.elapsed_m();
|
||||||
|
tm.reset();
|
||||||
|
for(int i=0; i<cc; ++i) {
|
||||||
|
PIString s = PIString::fromAscii(bigstr);
|
||||||
|
l = s.size();
|
||||||
|
}
|
||||||
|
piCout << l << "PIString::fromAscii" << tm.elapsed_m();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user