mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
replaced usleep() by rstime::rs_usleep() which accepts times >= 1 sec. Should fix problems on windows
This commit is contained in:
parent
c1fccef53b
commit
d0039241d3
@ -38,7 +38,7 @@
|
|||||||
#include "crypto/chacha20.h"
|
#include "crypto/chacha20.h"
|
||||||
#include "util/rsprint.h"
|
#include "util/rsprint.h"
|
||||||
#include "util/rsrandom.h"
|
#include "util/rsrandom.h"
|
||||||
#include "util/rsscopetimer.h"
|
#include "util/rstime.h"
|
||||||
|
|
||||||
#define rotl(x,n) { x = (x << n) | (x >> (-n & 31)) ;}
|
#define rotl(x,n) { x = (x << n) | (x >> (-n & 31)) ;}
|
||||||
|
|
||||||
@ -1385,27 +1385,27 @@ bool perform_tests()
|
|||||||
uint8_t received_tag[16] ;
|
uint8_t received_tag[16] ;
|
||||||
|
|
||||||
{
|
{
|
||||||
RsScopeTimer s("AEAD1") ;
|
rstime::RsScopeTimer s("AEAD1") ;
|
||||||
chacha20_encrypt_rs(key, 1, nonce, ten_megabyte_data,SIZE) ;
|
chacha20_encrypt_rs(key, 1, nonce, ten_megabyte_data,SIZE) ;
|
||||||
|
|
||||||
std::cerr << " Chacha20 encryption speed : " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
|
std::cerr << " Chacha20 encryption speed : " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
RsScopeTimer s("AEAD2") ;
|
rstime::RsScopeTimer s("AEAD2") ;
|
||||||
AEAD_chacha20_poly1305_rs(key,nonce,ten_megabyte_data,SIZE,aad,12,received_tag,true) ;
|
AEAD_chacha20_poly1305_rs(key,nonce,ten_megabyte_data,SIZE,aad,12,received_tag,true) ;
|
||||||
|
|
||||||
std::cerr << " AEAD/poly1305 own encryption speed : " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
|
std::cerr << " AEAD/poly1305 own encryption speed : " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
|
||||||
}
|
}
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x010100000L && !defined(LIBRESSL_VERSION_NUMBER)
|
#if OPENSSL_VERSION_NUMBER >= 0x010100000L && !defined(LIBRESSL_VERSION_NUMBER)
|
||||||
{
|
{
|
||||||
RsScopeTimer s("AEAD3") ;
|
rstime::RsScopeTimer s("AEAD3") ;
|
||||||
AEAD_chacha20_poly1305_openssl(key,nonce,ten_megabyte_data,SIZE,aad,12,received_tag,true) ;
|
AEAD_chacha20_poly1305_openssl(key,nonce,ten_megabyte_data,SIZE,aad,12,received_tag,true) ;
|
||||||
|
|
||||||
std::cerr << " AEAD/poly1305 openssl encryption speed: " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
|
std::cerr << " AEAD/poly1305 openssl encryption speed: " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
RsScopeTimer s("AEAD4") ;
|
rstime::RsScopeTimer s("AEAD4") ;
|
||||||
AEAD_chacha20_sha256(key,nonce,ten_megabyte_data,SIZE,aad,12,received_tag,true) ;
|
AEAD_chacha20_sha256(key,nonce,ten_megabyte_data,SIZE,aad,12,received_tag,true) ;
|
||||||
|
|
||||||
std::cerr << " AEAD/sha256 encryption speed : " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
|
std::cerr << " AEAD/sha256 encryption speed : " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "util/folderiterator.h"
|
#include "util/folderiterator.h"
|
||||||
|
#include "util/rstime.h"
|
||||||
#include "rsserver/p3face.h"
|
#include "rsserver/p3face.h"
|
||||||
|
|
||||||
#include "directory_storage.h"
|
#include "directory_storage.h"
|
||||||
@ -92,7 +93,7 @@ void LocalDirectoryUpdater::data_tick()
|
|||||||
|
|
||||||
for(uint32_t i=0;i<10;++i)
|
for(uint32_t i=0;i<10;++i)
|
||||||
{
|
{
|
||||||
usleep(1*1000*1000);
|
rstime::rs_usleep(1*1000*1000);
|
||||||
|
|
||||||
{
|
{
|
||||||
if(mForceUpdate)
|
if(mForceUpdate)
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "util/rsdir.h"
|
#include "util/rsdir.h"
|
||||||
#include "util/rsprint.h"
|
#include "util/rsprint.h"
|
||||||
#include "util/rsscopetimer.h"
|
#include "util/rstime.h"
|
||||||
#include "rsserver/p3face.h"
|
#include "rsserver/p3face.h"
|
||||||
#include "pqi/authssl.h"
|
#include "pqi/authssl.h"
|
||||||
#include "hash_cache.h"
|
#include "hash_cache.h"
|
||||||
@ -125,7 +125,7 @@ void HashStorage::data_tick()
|
|||||||
std::cerr << "nothing to hash. Sleeping for " << st << " us" << std::endl;
|
std::cerr << "nothing to hash. Sleeping for " << st << " us" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
usleep(st); // when no files to hash, just wait for 2 secs. This avoids a dramatic loop.
|
rstime::rs_usleep(st); // when no files to hash, just wait for 2 secs. This avoids a dramatic loop.
|
||||||
|
|
||||||
if(st > MAX_INACTIVITY_SLEEP_TIME)
|
if(st > MAX_INACTIVITY_SLEEP_TIME)
|
||||||
{
|
{
|
||||||
@ -163,7 +163,7 @@ void HashStorage::data_tick()
|
|||||||
|
|
||||||
if(paused) // we need to wait off mutex!!
|
if(paused) // we need to wait off mutex!!
|
||||||
{
|
{
|
||||||
usleep(MAX_INACTIVITY_SLEEP_TIME) ;
|
rstime::rs_usleep(MAX_INACTIVITY_SLEEP_TIME) ;
|
||||||
std::cerr << "Hashing process currently paused." << std::endl;
|
std::cerr << "Hashing process currently paused." << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ void HashStorage::data_tick()
|
|||||||
|
|
||||||
RsServer::notify()->notifyHashingInfo(NOTIFY_HASHTYPE_HASH_FILE, tmpout) ;
|
RsServer::notify()->notifyHashingInfo(NOTIFY_HASHTYPE_HASH_FILE, tmpout) ;
|
||||||
|
|
||||||
double seconds_origin = RsScopeTimer::currentTime() ;
|
double seconds_origin = rstime::RsScopeTimer::currentTime() ;
|
||||||
|
|
||||||
if(RsDirUtil::getFileHash(job.full_path, hash,size, this))
|
if(RsDirUtil::getFileHash(job.full_path, hash,size, this))
|
||||||
{
|
{
|
||||||
@ -215,7 +215,7 @@ void HashStorage::data_tick()
|
|||||||
else
|
else
|
||||||
std::cerr << "ERROR: cannot hash file " << job.full_path << std::endl;
|
std::cerr << "ERROR: cannot hash file " << job.full_path << std::endl;
|
||||||
|
|
||||||
mHashingTime += RsScopeTimer::currentTime() - seconds_origin ;
|
mHashingTime += rstime::RsScopeTimer::currentTime() - seconds_origin ;
|
||||||
mHashedBytes += size ;
|
mHashedBytes += size ;
|
||||||
|
|
||||||
if(mHashingTime > 3)
|
if(mHashingTime > 3)
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "util/rsdiscspace.h"
|
#include "util/rsdiscspace.h"
|
||||||
#include "util/rsmemory.h"
|
#include "util/rsmemory.h"
|
||||||
|
#include "util/rstime.h"
|
||||||
|
|
||||||
#include "ft/ftcontroller.h"
|
#include "ft/ftcontroller.h"
|
||||||
|
|
||||||
@ -219,7 +220,7 @@ void ftController::data_tick()
|
|||||||
/* check the queues */
|
/* check the queues */
|
||||||
|
|
||||||
//Waiting 1 sec before start
|
//Waiting 1 sec before start
|
||||||
usleep(1*1000*1000); // 1 sec
|
rstime::rs_usleep(1*1000*1000); // 1 sec
|
||||||
|
|
||||||
#ifdef CONTROL_DEBUG
|
#ifdef CONTROL_DEBUG
|
||||||
//std::cerr << "ftController::run()";
|
//std::cerr << "ftController::run()";
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "ft/ftextralist.h"
|
#include "ft/ftextralist.h"
|
||||||
#include "rsitems/rsconfigitems.h"
|
#include "rsitems/rsconfigitems.h"
|
||||||
#include "util/rsdir.h"
|
#include "util/rsdir.h"
|
||||||
|
#include "util/rstime.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h> /* for (u)sleep() */
|
#include <unistd.h> /* for (u)sleep() */
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -64,12 +65,8 @@ void ftExtraList::data_tick()
|
|||||||
/* Hash a file */
|
/* Hash a file */
|
||||||
hashAFile();
|
hashAFile();
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
Sleep(1);
|
|
||||||
#else
|
|
||||||
/* microsleep */
|
/* microsleep */
|
||||||
usleep(10);
|
rstime::rs_usleep(10);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -513,16 +510,7 @@ bool ftExtraList::loadList(std::list<RsItem *>& load)
|
|||||||
delete (*it);
|
delete (*it);
|
||||||
|
|
||||||
/* short sleep */
|
/* short sleep */
|
||||||
#ifndef WINDOWS_SYS
|
rstime::rs_usleep(1000) ;
|
||||||
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
|
||||||
usleep(1000); /* 1000 per second */
|
|
||||||
|
|
||||||
#else
|
|
||||||
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
|
||||||
Sleep(1);
|
|
||||||
#endif
|
|
||||||
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
load.clear() ;
|
load.clear() ;
|
||||||
return true;
|
return true;
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||||
#include <util/rsscopetimer.h>
|
#include <util/rstime.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "rsdataservice.h"
|
#include "rsdataservice.h"
|
||||||
@ -1066,7 +1066,7 @@ bool RsDataService::validSize(RsNxsGrp* grp) const
|
|||||||
int RsDataService::retrieveNxsGrps(std::map<RsGxsGroupId, RsNxsGrp *> &grp, bool withMeta, bool /* cache */)
|
int RsDataService::retrieveNxsGrps(std::map<RsGxsGroupId, RsNxsGrp *> &grp, bool withMeta, bool /* cache */)
|
||||||
{
|
{
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||||
RsScopeTimer timer("");
|
rstime::RsScopeTimer timer("");
|
||||||
int resultCount = 0;
|
int resultCount = 0;
|
||||||
int requestedGroups = grp.size();
|
int requestedGroups = grp.size();
|
||||||
#endif
|
#endif
|
||||||
@ -1166,7 +1166,7 @@ void RsDataService::locked_retrieveGroups(RetroCursor* c, std::vector<RsNxsGrp*>
|
|||||||
int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, bool /* cache */, bool withMeta)
|
int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, bool /* cache */, bool withMeta)
|
||||||
{
|
{
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||||
RsScopeTimer timer("");
|
rstime::RsScopeTimer timer("");
|
||||||
int resultCount = 0;
|
int resultCount = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1254,7 +1254,7 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
|
|||||||
RsStackMutex stack(mDbMutex);
|
RsStackMutex stack(mDbMutex);
|
||||||
|
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||||
RsScopeTimer timer("");
|
rstime::RsScopeTimer timer("");
|
||||||
int resultCount = 0;
|
int resultCount = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1341,7 +1341,7 @@ int RsDataService::retrieveGxsGrpMetaData(RsGxsGrpMetaTemporaryMap& grp)
|
|||||||
RsStackMutex stack(mDbMutex);
|
RsStackMutex stack(mDbMutex);
|
||||||
|
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||||
RsScopeTimer timer("");
|
rstime::RsScopeTimer timer("");
|
||||||
int resultCount = 0;
|
int resultCount = 0;
|
||||||
int requestedGroups = grp.size();
|
int requestedGroups = grp.size();
|
||||||
#endif
|
#endif
|
||||||
@ -1549,7 +1549,7 @@ int RsDataService::retrieveGroupIds(std::vector<RsGxsGroupId> &grpIds)
|
|||||||
RsStackMutex stack(mDbMutex);
|
RsStackMutex stack(mDbMutex);
|
||||||
|
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||||
RsScopeTimer timer("");
|
rstime::RsScopeTimer timer("");
|
||||||
int resultCount = 0;
|
int resultCount = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1586,7 +1586,7 @@ int RsDataService::retrieveGroupIds(std::vector<RsGxsGroupId> &grpIds)
|
|||||||
int RsDataService::retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std_vector& msgIds)
|
int RsDataService::retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std_vector& msgIds)
|
||||||
{
|
{
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||||
RsScopeTimer timer("");
|
rstime::RsScopeTimer timer("");
|
||||||
int resultCount = 0;
|
int resultCount = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "gxssecurity.h"
|
#include "gxssecurity.h"
|
||||||
#include "util/contentvalue.h"
|
#include "util/contentvalue.h"
|
||||||
#include "util/rsprint.h"
|
#include "util/rsprint.h"
|
||||||
|
#include "util/rstime.h"
|
||||||
#include "retroshare/rsgxsflags.h"
|
#include "retroshare/rsgxsflags.h"
|
||||||
#include "retroshare/rsgxscircles.h"
|
#include "retroshare/rsgxscircles.h"
|
||||||
#include "retroshare/rsgrouter.h"
|
#include "retroshare/rsgrouter.h"
|
||||||
@ -138,7 +139,7 @@ void RsGenExchange::data_tick()
|
|||||||
static const double timeDelta = 0.1; // slow tick in sec
|
static const double timeDelta = 0.1; // slow tick in sec
|
||||||
|
|
||||||
tick();
|
tick();
|
||||||
usleep((int) (timeDelta * 1000 *1000)); // timeDelta sec
|
rstime::rs_usleep((int) (timeDelta * 1000 *1000)); // timeDelta sec
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGenExchange::tick()
|
void RsGenExchange::tick()
|
||||||
|
@ -210,6 +210,7 @@
|
|||||||
#include "retroshare/rspeers.h"
|
#include "retroshare/rspeers.h"
|
||||||
#include "pgp/pgpauxutils.h"
|
#include "pgp/pgpauxutils.h"
|
||||||
#include "util/rsdir.h"
|
#include "util/rsdir.h"
|
||||||
|
#include "util/rstime.h"
|
||||||
#include "util/rsmemory.h"
|
#include "util/rsmemory.h"
|
||||||
#include "util/stacktrace.h"
|
#include "util/stacktrace.h"
|
||||||
|
|
||||||
@ -1787,7 +1788,7 @@ void RsGxsNetService::data_tick()
|
|||||||
static const double timeDelta = 0.5;
|
static const double timeDelta = 0.5;
|
||||||
|
|
||||||
//Start waiting as nothing to do in runup
|
//Start waiting as nothing to do in runup
|
||||||
usleep((int) (timeDelta * 1000 * 1000)); // timeDelta sec
|
rstime::rs_usleep((int) (timeDelta * 1000 * 1000)); // timeDelta sec
|
||||||
|
|
||||||
if(mUpdateCounter >= 120) // 60 seconds
|
if(mUpdateCounter >= 120) // 60 seconds
|
||||||
{
|
{
|
||||||
|
@ -547,7 +547,7 @@ HEADERS += util/folderiterator.h \
|
|||||||
util/rsmemcache.h \
|
util/rsmemcache.h \
|
||||||
util/rstickevent.h \
|
util/rstickevent.h \
|
||||||
util/rsrecogn.h \
|
util/rsrecogn.h \
|
||||||
util/rsscopetimer.h \
|
util/rstime.h \
|
||||||
util/stacktrace.h \
|
util/stacktrace.h \
|
||||||
util/rsdeprecate.h \
|
util/rsdeprecate.h \
|
||||||
util/cxx11retrocompat.h
|
util/cxx11retrocompat.h
|
||||||
@ -695,7 +695,7 @@ SOURCES += util/folderiterator.cc \
|
|||||||
util/rsrandom.cc \
|
util/rsrandom.cc \
|
||||||
util/rstickevent.cc \
|
util/rstickevent.cc \
|
||||||
util/rsrecogn.cc \
|
util/rsrecogn.cc \
|
||||||
util/rsscopetimer.cc
|
util/rstime.cc
|
||||||
|
|
||||||
|
|
||||||
upnp_miniupnpc {
|
upnp_miniupnpc {
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "pgp/pgphandler.h"
|
#include "pgp/pgphandler.h"
|
||||||
|
|
||||||
#include <util/rsdir.h>
|
#include <util/rsdir.h>
|
||||||
|
#include <util/rstime.h>
|
||||||
#include <pgp/pgpkeyutil.h>
|
#include <pgp/pgpkeyutil.h>
|
||||||
#include <unistd.h> /* for (u)sleep() */
|
#include <unistd.h> /* for (u)sleep() */
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -187,7 +188,7 @@ int AuthGPG::GPGInit(const RsPgpId &ownId)
|
|||||||
|
|
||||||
void AuthGPG::data_tick()
|
void AuthGPG::data_tick()
|
||||||
{
|
{
|
||||||
usleep(100 * 1000); //100 msec
|
rstime::rs_usleep(100 * 1000); //100 msec
|
||||||
|
|
||||||
/// every 100 milliseconds
|
/// every 100 milliseconds
|
||||||
processServices();
|
processServices();
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include "util/rsdebug.h"
|
#include "util/rsdebug.h"
|
||||||
#include "util/rsnet.h"
|
#include "util/rsnet.h"
|
||||||
|
#include "util/rstime.h"
|
||||||
#include "util/rsstring.h"
|
#include "util/rsstring.h"
|
||||||
|
|
||||||
#include "pqi/p3linkmgr.h"
|
#include "pqi/p3linkmgr.h"
|
||||||
@ -571,7 +572,7 @@ bool pqissludp::moretoread(uint32_t usec)
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
usleep(usec);
|
rstime::rs_usleep(usec);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for more to read first ... if nothing... check error
|
/* check for more to read first ... if nothing... check error
|
||||||
@ -655,7 +656,7 @@ bool pqissludp::cansend(uint32_t usec)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(usec);
|
rstime::rs_usleep(usec);
|
||||||
}
|
}
|
||||||
|
|
||||||
rslog(RSL_DEBUG_ALL, pqissludpzone,
|
rslog(RSL_DEBUG_ALL, pqissludpzone,
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "util/rstime.h"
|
||||||
#include "pqi/pqithreadstreamer.h"
|
#include "pqi/pqithreadstreamer.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ void pqithreadstreamer::data_tick()
|
|||||||
|
|
||||||
if (!isactive)
|
if (!isactive)
|
||||||
{
|
{
|
||||||
usleep(DEFAULT_STREAMER_IDLE_SLEEP);
|
rstime::rs_usleep(DEFAULT_STREAMER_IDLE_SLEEP);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +93,7 @@ void pqithreadstreamer::data_tick()
|
|||||||
|
|
||||||
if (sleep_period)
|
if (sleep_period)
|
||||||
{
|
{
|
||||||
usleep(sleep_period);
|
rstime::rs_usleep(sleep_period);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "util/rstime.h"
|
||||||
#include "rsserver/p3face.h"
|
#include "rsserver/p3face.h"
|
||||||
#include "retroshare/rsplugin.h"
|
#include "retroshare/rsplugin.h"
|
||||||
|
|
||||||
@ -134,11 +135,7 @@ RsServer::~RsServer()
|
|||||||
/* Thread Fn: Run the Core */
|
/* Thread Fn: Run the Core */
|
||||||
void RsServer::data_tick()
|
void RsServer::data_tick()
|
||||||
{
|
{
|
||||||
#ifndef WINDOWS_SYS
|
rstime::rs_usleep(mTimeDelta * 1000000);
|
||||||
usleep((int) (mTimeDelta * 1000000));
|
|
||||||
#else
|
|
||||||
Sleep((int) (mTimeDelta * 1000));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
double ts = getCurrentTS();
|
double ts = getCurrentTS();
|
||||||
double delta = ts - mLastts;
|
double delta = ts - mLastts;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "util/radix32.h"
|
#include "util/radix32.h"
|
||||||
#include "util/radix64.h"
|
#include "util/radix64.h"
|
||||||
#include "util/rsdebug.h"
|
#include "util/rsdebug.h"
|
||||||
|
#include "util/rstime.h"
|
||||||
#include "util/rsprint.h"
|
#include "util/rsprint.h"
|
||||||
#include "util/rsrandom.h"
|
#include "util/rsrandom.h"
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ static struct RsLog::logInfo i2pBobLogInfo = {RsLog::Default, "p3I2pBob"};
|
|||||||
static const time_t selfCheckPeroid = 30;
|
static const time_t selfCheckPeroid = 30;
|
||||||
|
|
||||||
void doSleep(useconds_t timeToSleepMS) {
|
void doSleep(useconds_t timeToSleepMS) {
|
||||||
usleep((useconds_t) (timeToSleepMS * 1000));
|
rstime::rs_usleep((useconds_t) (timeToSleepMS * 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
p3I2pBob::p3I2pBob(p3PeerMgr *peerMgr)
|
p3I2pBob::p3I2pBob(p3PeerMgr *peerMgr)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "rsautoproxymonitor.h"
|
#include "rsautoproxymonitor.h"
|
||||||
|
|
||||||
#include <unistd.h> /* for usleep() */
|
#include <unistd.h> /* for usleep() */
|
||||||
|
#include "util/rstime.h"
|
||||||
|
|
||||||
rsAutoProxyMonitor *rsAutoProxyMonitor::mInstance = NULL;
|
rsAutoProxyMonitor *rsAutoProxyMonitor::mInstance = NULL;
|
||||||
|
|
||||||
@ -93,7 +94,7 @@ void rsAutoProxyMonitor::stopAllRSShutdown()
|
|||||||
// wait for shutdown of all services
|
// wait for shutdown of all services
|
||||||
uint32_t t = 0, timeout = 15;
|
uint32_t t = 0, timeout = 15;
|
||||||
do {
|
do {
|
||||||
usleep(1000 * 1000);
|
rstime::rs_usleep(1000 * 1000);
|
||||||
RS_STACK_MUTEX(mLock);
|
RS_STACK_MUTEX(mLock);
|
||||||
std::cout << "(II) waiting for auto proxy service(s) to shut down " << t << "/" << timeout << " (remaining: " << mProxies.size() << ")" << std::endl;
|
std::cout << "(II) waiting for auto proxy service(s) to shut down " << t << "/" << timeout << " (remaining: " << mProxies.size() << ")" << std::endl;
|
||||||
if (mProxies.empty())
|
if (mProxies.empty())
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "util/rsstring.h"
|
#include "util/rsstring.h"
|
||||||
#include "util/radix64.h"
|
#include "util/radix64.h"
|
||||||
#include "util/rsdir.h"
|
#include "util/rsdir.h"
|
||||||
|
#include "util/rstime.h"
|
||||||
#include "crypto/hashstream.h"
|
#include "crypto/hashstream.h"
|
||||||
#include "gxs/gxssecurity.h"
|
#include "gxs/gxssecurity.h"
|
||||||
#include "retroshare/rspeers.h"
|
#include "retroshare/rspeers.h"
|
||||||
@ -1071,7 +1072,7 @@ bool p3IdService::signData(const uint8_t *data,uint32_t data_size,const RsGxsId&
|
|||||||
#ifdef DEBUG_IDS
|
#ifdef DEBUG_IDS
|
||||||
std::cerr << " Cannot get key. Waiting for caching. try " << i << "/6" << std::endl;
|
std::cerr << " Cannot get key. Waiting for caching. try " << i << "/6" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
usleep(500 * 1000) ; // sleep for 500 msec.
|
rstime::rs_usleep(500 * 1000) ; // sleep for 500 msec.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break ;
|
break ;
|
||||||
@ -1110,7 +1111,7 @@ bool p3IdService::validateData(const uint8_t *data,uint32_t data_size,const RsTl
|
|||||||
#ifdef DEBUG_IDS
|
#ifdef DEBUG_IDS
|
||||||
std::cerr << " Cannot get key. Waiting for caching. try " << i << "/6" << std::endl;
|
std::cerr << " Cannot get key. Waiting for caching. try " << i << "/6" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if(force_load) usleep(500 * 1000) ; // sleep for 500 msec.
|
if(force_load) rstime::rs_usleep(500 * 1000) ; // sleep for 500 msec.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break ;
|
break ;
|
||||||
@ -1151,7 +1152,7 @@ bool p3IdService::encryptData( const uint8_t *decrypted_data,
|
|||||||
if(getKey(encryption_key_id,encryption_key))
|
if(getKey(encryption_key_id,encryption_key))
|
||||||
break ;
|
break ;
|
||||||
else
|
else
|
||||||
usleep(500*1000) ; // sleep half a sec.
|
rstime::rs_usleep(500*1000) ; // sleep half a sec.
|
||||||
|
|
||||||
if(encryption_key.keyId.isNull())
|
if(encryption_key.keyId.isNull())
|
||||||
{
|
{
|
||||||
@ -1222,7 +1223,7 @@ bool p3IdService::encryptData( const uint8_t* decrypted_data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(keyNotYetFoundIds.empty()) break;
|
if(keyNotYetFoundIds.empty()) break;
|
||||||
else usleep(500*1000);
|
else rstime::rs_usleep(500*1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!keyNotYetFoundIds.empty())
|
if(!keyNotYetFoundIds.empty())
|
||||||
@ -1279,7 +1280,7 @@ bool p3IdService::decryptData( const uint8_t *encrypted_data,
|
|||||||
int maxRounds = force_load ? 6 : 1;
|
int maxRounds = force_load ? 6 : 1;
|
||||||
for(int i=0; i<maxRounds ;++i)
|
for(int i=0; i<maxRounds ;++i)
|
||||||
if(getPrivateKey(key_id,encryption_key)) break;
|
if(getPrivateKey(key_id,encryption_key)) break;
|
||||||
else usleep(500*1000) ; // sleep half a sec.
|
else rstime::rs_usleep(500*1000) ; // sleep half a sec.
|
||||||
|
|
||||||
if(encryption_key.keyId.isNull())
|
if(encryption_key.keyId.isNull())
|
||||||
{
|
{
|
||||||
@ -1356,7 +1357,7 @@ bool p3IdService::decryptData( const uint8_t* encrypted_data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(keyNotYetFoundIds.empty()) break;
|
if(keyNotYetFoundIds.empty()) break;
|
||||||
else usleep(500*1000);
|
else rstime::rs_usleep(500*1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!keyNotYetFoundIds.empty())
|
if(!keyNotYetFoundIds.empty())
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "util/rsdir.h"
|
#include "util/rsdir.h"
|
||||||
#include "util/rsstring.h"
|
#include "util/rsstring.h"
|
||||||
#include "util/rsrandom.h"
|
#include "util/rsrandom.h"
|
||||||
|
#include "util/rstime.h"
|
||||||
#include "util/rsmemory.h"
|
#include "util/rsmemory.h"
|
||||||
#include "util/folderiterator.h"
|
#include "util/folderiterator.h"
|
||||||
#include "retroshare/rstypes.h"
|
#include "retroshare/rstypes.h"
|
||||||
@ -711,7 +712,7 @@ bool RsDirUtil::renameFile(const std::string& from, const std::string& to)
|
|||||||
#endif
|
#endif
|
||||||
/* set errno? */
|
/* set errno? */
|
||||||
return false ;
|
return false ;
|
||||||
usleep(100 * 1000); // 100 msec
|
rstime::rs_usleep(100 * 1000); // 100 msec
|
||||||
|
|
||||||
if (loops >= 30)
|
if (loops >= 30)
|
||||||
return false ;
|
return false ;
|
||||||
@ -917,7 +918,7 @@ RsStackFileLock::RsStackFileLock(const std::string& file_path)
|
|||||||
while(RsDirUtil::createLockFile(file_path,_file_handle))
|
while(RsDirUtil::createLockFile(file_path,_file_handle))
|
||||||
{
|
{
|
||||||
std::cerr << "Cannot acquire file lock " << file_path << ", waiting 1 sec." << std::endl;
|
std::cerr << "Cannot acquire file lock " << file_path << ", waiting 1 sec." << std::endl;
|
||||||
usleep(1 * 1000 * 1000) ; // 1 sec
|
rstime::rs_usleep(1 * 1000 * 1000) ; // 1 sec
|
||||||
}
|
}
|
||||||
#ifdef RSDIR_DEBUG
|
#ifdef RSDIR_DEBUG
|
||||||
std::cerr << "Acquired file handle " << _file_handle << ", lock file:" << file_path << std::endl;
|
std::cerr << "Acquired file handle " << _file_handle << ", lock file:" << file_path << std::endl;
|
||||||
@ -1321,7 +1322,7 @@ bool RsDirUtil::renameWideFile(const std::wstring& from, const std::wstring& to)
|
|||||||
#endif
|
#endif
|
||||||
/* set errno? */
|
/* set errno? */
|
||||||
return false ;
|
return false ;
|
||||||
usleep(100 * 1000); //100 msec
|
rstime::rs_usleep(100 * 1000); //100 msec
|
||||||
|
|
||||||
if (loops >= 30)
|
if (loops >= 30)
|
||||||
return false ;
|
return false ;
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include "util/rstime.h"
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
int __attribute__((weak)) pthread_setname_np(const char *__buf) ;
|
int __attribute__((weak)) pthread_setname_np(const char *__buf) ;
|
||||||
int RS_pthread_setname_np(pthread_t /*__target_thread*/, const char *__buf) {
|
int RS_pthread_setname_np(pthread_t /*__target_thread*/, const char *__buf) {
|
||||||
@ -289,7 +291,7 @@ void RsQueueThread::data_tick()
|
|||||||
THREAD_DEBUG << "RsQueueThread::data_tick() no work: sleeping for: " << mLastSleep << " ms" << std::endl;
|
THREAD_DEBUG << "RsQueueThread::data_tick() no work: sleeping for: " << mLastSleep << " ms" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
usleep(mLastSleep * 1000); // mLastSleep msec
|
rstime::rs_usleep(mLastSleep * 1000); // mLastSleep msec
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsMutex::unlock()
|
void RsMutex::unlock()
|
||||||
|
@ -24,8 +24,28 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <thread>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include "rsscopetimer.h"
|
#include <sys/unistd.h>
|
||||||
|
#include "rstime.h"
|
||||||
|
|
||||||
|
namespace rstime {
|
||||||
|
|
||||||
|
int rs_usleep(uint32_t micro_seconds)
|
||||||
|
{
|
||||||
|
while(micro_seconds >= 1000000)
|
||||||
|
{
|
||||||
|
// usleep cannot be called with 1000000 or more.
|
||||||
|
|
||||||
|
usleep(500000) ;
|
||||||
|
usleep(500000) ;
|
||||||
|
|
||||||
|
micro_seconds -= 1000000 ;
|
||||||
|
}
|
||||||
|
usleep(micro_seconds) ;
|
||||||
|
|
||||||
|
return 0 ;
|
||||||
|
}
|
||||||
|
|
||||||
RsScopeTimer::RsScopeTimer(const std::string& name)
|
RsScopeTimer::RsScopeTimer(const std::string& name)
|
||||||
{
|
{
|
||||||
@ -57,3 +77,5 @@ double RsScopeTimer::duration()
|
|||||||
{
|
{
|
||||||
return currentTime() - _seconds;
|
return currentTime() - _seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@ -23,29 +23,40 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Use this class to measure and display time duration of a given environment:
|
|
||||||
//
|
|
||||||
// {
|
|
||||||
// RsScopeTimer timer("callToMeasure()") ;
|
|
||||||
//
|
|
||||||
// callToMeasure() ;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class RsScopeTimer
|
namespace rstime {
|
||||||
{
|
|
||||||
public:
|
|
||||||
RsScopeTimer(const std::string& name);
|
|
||||||
~RsScopeTimer();
|
|
||||||
|
|
||||||
void start();
|
/*!
|
||||||
double duration();
|
* \brief This is a cross-system definition of usleep, which accepts any 32 bits number of micro-seconds.
|
||||||
|
*/
|
||||||
|
|
||||||
static double currentTime();
|
int rs_usleep(uint32_t micro_seconds);
|
||||||
|
|
||||||
private:
|
/* Use this class to measure and display time duration of a given environment:
|
||||||
std::string _name ;
|
|
||||||
double _seconds ;
|
{
|
||||||
};
|
RsScopeTimer timer("callToMeasure()") ;
|
||||||
|
|
||||||
|
callToMeasure() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
class RsScopeTimer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RsScopeTimer(const std::string& name);
|
||||||
|
~RsScopeTimer();
|
||||||
|
|
||||||
|
void start();
|
||||||
|
double duration();
|
||||||
|
|
||||||
|
static double currentTime();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string _name ;
|
||||||
|
double _seconds ;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -26,6 +26,7 @@
|
|||||||
#include "retroshare/rsiface.h"
|
#include "retroshare/rsiface.h"
|
||||||
#include "retroshare/rsgxsforums.h"
|
#include "retroshare/rsgxsforums.h"
|
||||||
#include "util/rsstring.h"
|
#include "util/rsstring.h"
|
||||||
|
#include "util/rstime.h"
|
||||||
#include "gxs/rsgenexchange.h"
|
#include "gxs/rsgenexchange.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -2240,7 +2241,7 @@ bool p3FeedReader::waitForToken(uint32_t token)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(500 * 1000); // sleep for 500 msec
|
rstime::rs_usleep(500 * 1000); // sleep for 500 msec
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "p3FeedReaderThread.h"
|
#include "p3FeedReaderThread.h"
|
||||||
#include "rsFeedReaderItems.h"
|
#include "rsFeedReaderItems.h"
|
||||||
#include "util/rsstring.h"
|
#include "util/rsstring.h"
|
||||||
|
#include "util/rstime.h"
|
||||||
#include "util/CURLWrapper.h"
|
#include "util/CURLWrapper.h"
|
||||||
#include "util/XMLWrapper.h"
|
#include "util/XMLWrapper.h"
|
||||||
#include "util/HTMLWrapper.h"
|
#include "util/HTMLWrapper.h"
|
||||||
@ -51,11 +52,8 @@ p3FeedReaderThread::~p3FeedReaderThread()
|
|||||||
|
|
||||||
void p3FeedReaderThread::data_tick()
|
void p3FeedReaderThread::data_tick()
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
rstime::rs_usleep(1000000);
|
||||||
Sleep(1000);
|
|
||||||
#else
|
|
||||||
usleep(1000000);
|
|
||||||
#endif
|
|
||||||
/* every second */
|
/* every second */
|
||||||
|
|
||||||
switch (mType) {
|
switch (mType) {
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <QGraphicsDropShadowEffect>
|
#include <QGraphicsDropShadowEffect>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include "util/rstime.h"
|
||||||
|
|
||||||
#include "TorControlWindow.h"
|
#include "TorControlWindow.h"
|
||||||
#include "TorManager.h"
|
#include "TorManager.h"
|
||||||
@ -152,7 +153,7 @@ TorControlDialog::TorStatus TorControlDialog::checkForTor()
|
|||||||
{
|
{
|
||||||
switch(mTorManager->control()->torStatus())
|
switch(mTorManager->control()->torStatus())
|
||||||
{
|
{
|
||||||
case Tor::TorControl::TorReady: usleep(1*1000*1000);return TOR_STATUS_OK ;
|
case Tor::TorControl::TorReady: rstime::rs_usleep(1*1000*1000);return TOR_STATUS_OK ;
|
||||||
default:
|
default:
|
||||||
return TOR_STATUS_UNKNOWN ;
|
return TOR_STATUS_UNKNOWN ;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,8 @@
|
|||||||
#include "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
#include "util/QtVersion.h"
|
#include "util/QtVersion.h"
|
||||||
|
|
||||||
#include <retroshare/rsnotify.h>
|
#include "retroshare/rsnotify.h"
|
||||||
|
#include "util/rstime.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -339,7 +340,7 @@ void ChatLobbyDialog::init(const ChatId &/*id*/, const QString &/*title*/)
|
|||||||
if(rsIdentity->getIdDetails(gxs_id,details))
|
if(rsIdentity->getIdDetails(gxs_id,details))
|
||||||
break ;
|
break ;
|
||||||
else
|
else
|
||||||
usleep(1000*300) ;
|
rstime::rs_usleep(1000*300) ;
|
||||||
|
|
||||||
ui.chatWidget->setName(QString::fromUtf8(details.mNickname.c_str()));
|
ui.chatWidget->setName(QString::fromUtf8(details.mNickname.c_str()));
|
||||||
//ui.chatWidget->addToolsAction(ui.actionChangeNickname);
|
//ui.chatWidget->addToolsAction(ui.actionChangeNickname);
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include "lang/languagesupport.h"
|
#include "lang/languagesupport.h"
|
||||||
#include "util/RsGxsUpdateBroadcast.h"
|
#include "util/RsGxsUpdateBroadcast.h"
|
||||||
#include "util/rsdir.h"
|
#include "util/rsdir.h"
|
||||||
|
#include "util/rstime.h"
|
||||||
|
|
||||||
#ifdef RETROTOR
|
#ifdef RETROTOR
|
||||||
#include "TorControl/TorManager.h"
|
#include "TorControl/TorManager.h"
|
||||||
@ -371,7 +372,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||||||
while(tcd.checkForTor() != TorControlDialog::TOR_STATUS_OK || tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK) // runs until some status is reached: either tor works, or it fails.
|
while(tcd.checkForTor() != TorControlDialog::TOR_STATUS_OK || tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK) // runs until some status is reached: either tor works, or it fails.
|
||||||
{
|
{
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
usleep(0.2*1000*1000) ;
|
rstime::rs_usleep(0.2*1000*1000) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
tcd.hide();
|
tcd.hide();
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include "gui/RetroShareLink.h"
|
#include "gui/RetroShareLink.h"
|
||||||
#include "util/ObjectPainter.h"
|
#include "util/ObjectPainter.h"
|
||||||
#include "util/imageutil.h"
|
#include "util/imageutil.h"
|
||||||
#include "util/rsscopetimer.h"
|
#include "util/rstime.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@ -1151,7 +1151,7 @@ bool RsHtml::makeEmbeddedImage(const QString &fileName, QString &embeddedImage,
|
|||||||
/** Converts image to embedded image HTML fragment **/
|
/** Converts image to embedded image HTML fragment **/
|
||||||
bool RsHtml::makeEmbeddedImage(const QImage &originalImage, QString &embeddedImage, const int maxPixels, const int maxBytes)
|
bool RsHtml::makeEmbeddedImage(const QImage &originalImage, QString &embeddedImage, const int maxPixels, const int maxBytes)
|
||||||
{
|
{
|
||||||
RsScopeTimer s("Embed image");
|
rstime::RsScopeTimer s("Embed image");
|
||||||
QImage opt;
|
QImage opt;
|
||||||
return ImageUtil::optimizeSize(embeddedImage, originalImage, opt, maxPixels, maxBytes);
|
return ImageUtil::optimizeSize(embeddedImage, originalImage, opt, maxPixels, maxBytes);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "imageutil.h"
|
#include "imageutil.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
#include "util/rsscopetimer.h"
|
#include "util/rstime.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
@ -113,7 +113,7 @@ bool ImageUtil::optimizeSize(QString &html, const QImage& original, QImage &opti
|
|||||||
|
|
||||||
int ImageUtil::checkSize(QString &embeddedImage, const QImage &img, int maxBytes)
|
int ImageUtil::checkSize(QString &embeddedImage, const QImage &img, int maxBytes)
|
||||||
{
|
{
|
||||||
RsScopeTimer st("Check size");
|
rstime::RsScopeTimer st("Check size");
|
||||||
|
|
||||||
QByteArray bytearray;
|
QByteArray bytearray;
|
||||||
QBuffer buffer(&bytearray);
|
QBuffer buffer(&bytearray);
|
||||||
@ -166,7 +166,7 @@ void ImageUtil::quantization(const QImage &img, QVector<QRgb> &palette)
|
|||||||
int bits = 4; // bits/pixel
|
int bits = 4; // bits/pixel
|
||||||
int samplesize = 100000; //only take this many color samples
|
int samplesize = 100000; //only take this many color samples
|
||||||
|
|
||||||
RsScopeTimer st("Quantization");
|
rstime::RsScopeTimer st("Quantization");
|
||||||
QSet<QRgb> colors;
|
QSet<QRgb> colors;
|
||||||
|
|
||||||
//collect color information
|
//collect color information
|
||||||
|
@ -30,7 +30,8 @@
|
|||||||
#include "notifytxt.h"
|
#include "notifytxt.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <util/argstream.h>
|
#include "util/argstream.h"
|
||||||
|
#include "util/rstime.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#ifdef WINDOWS_SYS
|
#ifdef WINDOWS_SYS
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
@ -105,7 +106,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
while(ctrl_mod.processShouldExit() == false)
|
while(ctrl_mod.processShouldExit() == false)
|
||||||
{
|
{
|
||||||
usleep(1000*1000);
|
rstime::rs_usleep(1000*1000);
|
||||||
|
|
||||||
if(!tac.isRunning() && !already)
|
if(!tac.isRunning() && !already)
|
||||||
{
|
{
|
||||||
@ -224,7 +225,7 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(1000);
|
rstime::rs_usleep(1000);
|
||||||
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user