diff options
author | Memphiz <memphis@machzwo.de> | 2012-05-01 21:47:20 +0200 |
---|---|---|
committer | Jim Carroll <thecarrolls@jiminger.com> | 2012-05-01 18:03:13 -0400 |
commit | 4d6b7020d3fd90d0d6f8724d7e0b9769fa59ef47 (patch) | |
tree | 22cdfef8b3976b58b20b8d2d82599f065c58a1b3 | |
parent | b88b78cd939f8f7ad28b5e01f6c48c1f1873efa6 (diff) |
[fix] - sync xcode projects for ios and atv2
-rw-r--r-- | XBMC.xcodeproj/project.pbxproj | 24 | ||||
-rw-r--r-- | tools/darwin/depends/Makefile.in | 2 | ||||
-rw-r--r-- | xbmc/threads/Thread.h | 13 | ||||
-rw-r--r-- | xbmc/threads/platform/pthreads/ThreadImpl.cpp | 40 |
4 files changed, 63 insertions, 16 deletions
diff --git a/XBMC.xcodeproj/project.pbxproj b/XBMC.xcodeproj/project.pbxproj index 129593a3c9..8198a9234d 100644 --- a/XBMC.xcodeproj/project.pbxproj +++ b/XBMC.xcodeproj/project.pbxproj @@ -1217,6 +1217,10 @@ E4DC97560FFE5BA8008E0C07 /* SAPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4DC97500FFE5BA8008E0C07 /* SAPDirectory.cpp */; }; E4DC97570FFE5BA8008E0C07 /* SAPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4DC97520FFE5BA8008E0C07 /* SAPFile.cpp */; }; E4E91BB80E7F7338001F0546 /* NptXbmcFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4E91BB70E7F7338001F0546 /* NptXbmcFile.cpp */; }; + EC720A8F155091BB00FFD782 /* ilog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC720A8D155091BB00FFD782 /* ilog.cpp */; }; + EC720A90155091BB00FFD782 /* ilog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC720A8D155091BB00FFD782 /* ilog.cpp */; }; + EC720A9D1550927000FFD782 /* XbmcContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC720A9B1550927000FFD782 /* XbmcContext.cpp */; }; + EC720A9E1550927000FFD782 /* XbmcContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC720A9B1550927000FFD782 /* XbmcContext.cpp */; }; F506297A0E57B9680066625A /* MultiPathFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F50629780E57B9680066625A /* MultiPathFile.cpp */; }; F50FDC5A119B4B2C00C8B8CD /* GUIDialogTextViewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F50FDC59119B4B2C00C8B8CD /* GUIDialogTextViewer.cpp */; }; F50FDC5B119B4B2C00C8B8CD /* GUIDialogTextViewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F50FDC59119B4B2C00C8B8CD /* GUIDialogTextViewer.cpp */; }; @@ -3769,6 +3773,10 @@ E4DF6CD90EFF85EB00C28243 /* LICENSE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE.txt; sourceTree = "<group>"; }; E4DF6CDA0EFF85EB00C28243 /* README.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.txt; sourceTree = "<group>"; }; E4E91BB70E7F7338001F0546 /* NptXbmcFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NptXbmcFile.cpp; sourceTree = "<group>"; }; + EC720A8D155091BB00FFD782 /* ilog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ilog.cpp; path = commons/ilog.cpp; sourceTree = "<group>"; }; + EC720A8E155091BB00FFD782 /* ilog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ilog.h; path = commons/ilog.h; sourceTree = "<group>"; }; + EC720A9B1550927000FFD782 /* XbmcContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XbmcContext.cpp; sourceTree = "<group>"; }; + EC720A9C1550927000FFD782 /* XbmcContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XbmcContext.h; sourceTree = "<group>"; }; F50629780E57B9680066625A /* MultiPathFile.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MultiPathFile.cpp; sourceTree = "<group>"; }; F50629790E57B9680066625A /* MultiPathFile.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MultiPathFile.h; sourceTree = "<group>"; }; F50FDC58119B4B2C00C8B8CD /* GUIDialogTextViewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogTextViewer.h; sourceTree = "<group>"; }; @@ -5190,6 +5198,7 @@ E38E14610D25F9F900618676 /* xbmc */ = { isa = PBXGroup; children = ( + EC720A91155091CA00FFD782 /* commons */, 18B49FF01152BEEB001AF8A6 /* addons */, E38E147F0D25F9F900618676 /* cdrip */, E38E149A0D25F9F900618676 /* cores */, @@ -5289,6 +5298,8 @@ 384718D61325BA04000486D6 /* XBDateTime.cpp */, 384718D71325BA04000486D6 /* XBDateTime.h */, E38E1ED10D25F9FD00618676 /* xbmc.cpp */, + EC720A9B1550927000FFD782 /* XbmcContext.cpp */, + EC720A9C1550927000FFD782 /* XbmcContext.h */, ); path = xbmc; sourceTree = "<group>"; @@ -6821,6 +6832,15 @@ path = utils; sourceTree = "<group>"; }; + EC720A91155091CA00FFD782 /* commons */ = { + isa = PBXGroup; + children = ( + EC720A8D155091BB00FFD782 /* ilog.cpp */, + EC720A8E155091BB00FFD782 /* ilog.h */, + ); + name = commons; + sourceTree = "<group>"; + }; F551106A0F5C424700955236 /* libhts */ = { isa = PBXGroup; children = ( @@ -8195,6 +8215,8 @@ C8936052152C86CF00812418 /* monitor.cpp in Sources */, C8936056152C86D800812418 /* PythonMonitor.cpp in Sources */, 7C1F6EBB13ECCFA7001726AB /* LibraryDirectory.cpp in Sources */, + EC720A8F155091BB00FFD782 /* ilog.cpp in Sources */, + EC720A9D1550927000FFD782 /* XbmcContext.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -9133,6 +9155,8 @@ C8936053152C86CF00812418 /* monitor.cpp in Sources */, C8936057152C86D800812418 /* PythonMonitor.cpp in Sources */, 7C1F6EBC13ECCFA7001726AB /* LibraryDirectory.cpp in Sources */, + EC720A90155091BB00FFD782 /* ilog.cpp in Sources */, + EC720A9E1550927000FFD782 /* XbmcContext.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/tools/darwin/depends/Makefile.in b/tools/darwin/depends/Makefile.in index ccf6b41b41..bcf1f60652 100644 --- a/tools/darwin/depends/Makefile.in +++ b/tools/darwin/depends/Makefile.in @@ -12,7 +12,7 @@ SUBDIRS := \ libGLEW libsdl libsdl_mixer libsdl_image \ libmicrohttpd libmodplug libbluray libyajl \ libgpg-error libgcrypt afpfs-ng \ - libplist libshairport libcec tinyxml \ + libplist libshairport tinyxml \ samba python26 distribute distutilscross \ mysqlclient boost \ diff --git a/xbmc/threads/Thread.h b/xbmc/threads/Thread.h index e513606454..80caa32298 100644 --- a/xbmc/threads/Thread.h +++ b/xbmc/threads/Thread.h @@ -32,6 +32,10 @@ #include "threads/ThreadLocal.h" #include "commons/ilog.h" +#ifdef TARGET_DARWIN +#include <mach/mach.h> +#endif + class IRunnable { public: @@ -74,7 +78,6 @@ public: static bool IsCurrentThread(const ThreadIdentifier tid); static ThreadIdentifier GetCurrentThreadId(); static CThread* GetCurrentThread(); - static int64_t GetCurrentThreadUsage(); static inline void SetLogger(XbmcCommons::ILogger* logger_) { CThread::logger = logger_; } protected: virtual void OnStartup(){}; @@ -126,4 +129,12 @@ private: float m_fLastUsage; std::string m_ThreadName; + +#ifdef __APPLE__ + // Save the Mach thrad port, I don't think it can be obtained from + // the pthread_t. We'll use it for querying timer information. + // + mach_port_t m_machThreadPort; +#endif + }; diff --git a/xbmc/threads/platform/pthreads/ThreadImpl.cpp b/xbmc/threads/platform/pthreads/ThreadImpl.cpp index 6807669e19..9d875ec07d 100644 --- a/xbmc/threads/platform/pthreads/ThreadImpl.cpp +++ b/xbmc/threads/platform/pthreads/ThreadImpl.cpp @@ -111,6 +111,7 @@ bool CThread::SetPriority(const int iPriority) bReturn = false; else if (iPriority >= minRR) bReturn = SetPrioritySched_RR(iPriority); +#ifndef TARGET_DARWIN else { // get user max prio @@ -140,6 +141,7 @@ bool CThread::SetPriority(const int iPriority) else if (logger) logger->Log(LOGERROR, "%s: error %s", __FUNCTION__, strerror(errno)); } +#endif return bReturn; } @@ -174,14 +176,37 @@ int64_t CThread::GetAbsoluteUsage() if (!m_ThreadId) return 0; - clockid_t clock; int64_t time = 0; +#ifdef TARGET_DARWIN + thread_info_data_t threadInfo; + mach_msg_type_number_t threadInfoCount = THREAD_INFO_MAX; + + if (m_machThreadPort == MACH_PORT_NULL) + m_machThreadPort = pthread_mach_thread_np(m_ThreadId); + + kern_return_t ret = thread_info(m_machThreadPort, THREAD_BASIC_INFO, (thread_info_t)threadInfo, &threadInfoCount); + + if (ret == KERN_SUCCESS) + { + thread_basic_info_t threadBasicInfo = (thread_basic_info_t)threadInfo; + + // User time. + time = ((int64_t)threadBasicInfo->user_time.seconds * 10000000L) + threadBasicInfo->user_time.microseconds*10L; + + // System time. + time += (((int64_t)threadBasicInfo->system_time.seconds * 10000000L) + threadBasicInfo->system_time.microseconds*10L); + } + +#else + clockid_t clock; if (pthread_getcpuclockid(m_ThreadId, &clock) == 0) { struct timespec tp; clock_gettime(clock, &tp); time = (int64_t)tp.tv_sec * 10000000 + tp.tv_nsec/100; } +#endif + return time; } @@ -204,17 +229,4 @@ float CThread::GetRelativeUsage() return m_fLastUsage; } -int64_t CThread::GetCurrentThreadUsage() -{ - pthread_t tid = pthread_self(); - clockid_t clock; - int64_t time = 0; - if (pthread_getcpuclockid(tid, &clock) == 0) - { - struct timespec tp; - clock_gettime(clock, &tp); - time = (int64_t)tp.tv_sec * 10000000 + tp.tv_nsec/100; - } - return time; -} |