Sha256: 61662fe49ad808c868d0982f847e293ee7b1bd9a37b45e1a0e7be891588c1bae

Contents?: true

Size: 1.26 KB

Versions: 22

Compression:

Stored size: 1.26 KB

Contents

#import "InitMemoryInfoCollector.h"

#include "../shared/common/RhoStd.h"
#include "../shared/common/AutoPointer.h"
#include "../shared/logging/RhoLogConf.h"
#include <sstream>

#import <mach/mach.h>

namespace rho
{
    namespace common
    {
        
        class IPhoneMemoryInfoCollector : public IMemoryInfoCollector
        {
        public:
            virtual String collect()
            {
                struct task_basic_info info;
                mach_msg_type_number_t size = sizeof(info);
                kern_return_t kerr = task_info(mach_task_self(),TASK_BASIC_INFO,(task_info_t)&info,&size);
                if ( KERN_SUCCESS == kerr )
                {
                    std::stringstream s;
                    s << info.resident_size;
                    return "Memory info: \nResident size: " + s.str() + "\n";
                }
                else
                {
                    return "Can't get memory info\n";
                }
                
            }
        };
        
    }
    
}

static rho::common::CAutoPtr<rho::common::IPhoneMemoryInfoCollector> s_memory_info_collector(new rho::common::IPhoneMemoryInfoCollector());

extern "C"
{

void InitMemoryInfoCollector()
{
    LOGCONF().setMemoryInfoCollector(s_memory_info_collector);
}

}

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
rhodes-7.6.0 platform/iphone/Classes/InitMemoryInfoCollector.mm
rhodes-7.5.1 platform/iphone/Classes/InitMemoryInfoCollector.mm
rhodes-7.4.1 platform/iphone/Classes/InitMemoryInfoCollector.mm
rhodes-7.1.17 platform/iphone/Classes/InitMemoryInfoCollector.mm
rhodes-6.2.0 platform/iphone/Classes/InitMemoryInfoCollector.mm
rhodes-6.0.11 platform/iphone/Classes/InitMemoryInfoCollector.mm
rhodes-5.5.18 platform/iphone/Classes/InitMemoryInfoCollector.mm
rhodes-5.5.17 platform/iphone/Classes/InitMemoryInfoCollector.mm
rhodes-5.5.15 platform/iphone/Classes/InitMemoryInfoCollector.mm
rhodes-5.5.0.22 platform/iphone/Classes/InitMemoryInfoCollector.mm
rhodes-5.5.2 platform/iphone/Classes/InitMemoryInfoCollector.mm
rhodes-5.5.0.7 platform/iphone/Classes/InitMemoryInfoCollector.mm
rhodes-5.5.0.3 platform/iphone/Classes/InitMemoryInfoCollector.mm
rhodes-5.5.0 platform/iphone/Classes/InitMemoryInfoCollector.mm
tauplatform-1.0.3 platform/iphone/Classes/InitMemoryInfoCollector.mm
tauplatform-1.0.2 platform/iphone/Classes/InitMemoryInfoCollector.mm
tauplatform-1.0.1 platform/iphone/Classes/InitMemoryInfoCollector.mm
rhodes-3.5.1.12 platform/iphone/Classes/InitMemoryInfoCollector.mm
rhodes-3.3.5 platform/iphone/Classes/InitMemoryInfoCollector.mm
rhodes-3.4.2 platform/iphone/Classes/InitMemoryInfoCollector.mm