add memory probes in libdanew.cpp
authorAnastasia Lyupa <a.lyupa@samsung.com>
Fri, 21 Jun 2013 14:24:34 +0000 (18:24 +0400)
committerAnastasia Lyupa <a.lyupa@samsung.com>
Fri, 21 Jun 2013 14:24:34 +0000 (18:24 +0400)
probe_memory/libdanew.cpp

index 7f4b49e..3c9597c 100644 (file)
@@ -100,6 +100,13 @@ void *operator new[](std::size_t size) throw (std::bad_alloc)
        POST_PROBEBLOCK_BEGIN_MEM(LC_MEMORY, "new", VT_PTR, pret, "%u", size);
        POST_PROBEBLOCK_MIDDLE_MEM(size, MEMORY_API_ALLOC, pret);
        APPEND_LOG_CALLSTACK();
+       
+       PREPARE_LOCAL_BUF();
+       PACK_COMMON_BEGIN(MSG_PROBE_MEMORY, LC_MEMORY, "d", size);
+       PACK_COMMON_END(pret, newerrno, blockresult);
+       PACK_MEMORY(size, MEMORY_API_ALLOC, pret);
+       FLUSH_LOCAL_BUF();
+       
        POST_PROBEBLOCK_END();
 
        return pret;
@@ -125,6 +132,13 @@ void operator delete(void *ptr) throw()
        POST_PROBEBLOCK_BEGIN_MEM(LC_MEMORY, "delete", VT_NULL, NULL, "%p", ptr);
        POST_PROBEBLOCK_MIDDLE_MEM(0, MEMORY_API_FREE, ptr);
        POST_PROBEBLOCK_CALLSTACK();
+       
+       PREPARE_LOCAL_BUF();
+       PACK_COMMON_BEGIN(MSG_PROBE_MEMORY, LC_MEMORY, "p", ptr);
+       PACK_COMMON_END(0, newerrno, blockresult);
+       PACK_MEMORY(0, MEMORY_API_FREE, ptr);
+       FLUSH_LOCAL_BUF();
+       
        POST_PROBEBLOCK_END();
 }
 
@@ -148,6 +162,13 @@ void operator delete[](void *ptr) throw()
        POST_PROBEBLOCK_BEGIN_MEM(LC_MEMORY, "delete", VT_NULL, NULL, "%p", ptr);
        POST_PROBEBLOCK_MIDDLE_MEM(0, MEMORY_API_FREE, ptr);
        POST_PROBEBLOCK_CALLSTACK();
+       
+       PREPARE_LOCAL_BUF();
+       PACK_COMMON_BEGIN(MSG_PROBE_MEMORY, LC_MEMORY, "p", ptr);
+       PACK_COMMON_END(0, newerrno, blockresult);
+       PACK_MEMORY(0, MEMORY_API_FREE, ptr);
+       FLUSH_LOCAL_BUF();
+       
        POST_PROBEBLOCK_END();
 }
 
@@ -172,6 +193,13 @@ void *operator new(std::size_t size, const std::nothrow_t& nothrow) throw()
        POST_PROBEBLOCK_BEGIN_MEM(LC_MEMORY, "new", VT_PTR, pret, "%u", size);
        POST_PROBEBLOCK_MIDDLE_MEM(size, MEMORY_API_ALLOC, pret);
        APPEND_LOG_CALLSTACK();
+       
+       PREPARE_LOCAL_BUF();
+       PACK_COMMON_BEGIN(MSG_PROBE_MEMORY, LC_MEMORY, "dp", size, &nothrow);
+       PACK_COMMON_END(pret, newerrno, blockresult);
+       PACK_MEMORY(size, MEMORY_API_ALLOC, pret);
+       FLUSH_LOCAL_BUF();
+       
        POST_PROBEBLOCK_END();
 
        return pret;
@@ -198,6 +226,13 @@ void *operator new[](std::size_t size, const std::nothrow_t& nothrow) throw()
        POST_PROBEBLOCK_BEGIN_MEM(LC_MEMORY, "new", VT_PTR, pret, "%u", size);
        POST_PROBEBLOCK_MIDDLE_MEM(size, MEMORY_API_ALLOC, pret);
        APPEND_LOG_CALLSTACK();
+       
+       PREPARE_LOCAL_BUF();
+       PACK_COMMON_BEGIN(MSG_PROBE_MEMORY, LC_MEMORY, "dp", size, &nothrow);
+       PACK_COMMON_END(pret, newerrno, blockresult);
+       PACK_MEMORY(size, MEMORY_API_ALLOC, pret);
+       FLUSH_LOCAL_BUF();
+       
        POST_PROBEBLOCK_END();
 
        return pret;
@@ -223,6 +258,13 @@ void operator delete(void *ptr, const std::nothrow_t& nothrow) throw()
        POST_PROBEBLOCK_BEGIN_MEM(LC_MEMORY, "delete", VT_NULL, NULL, "%p", ptr);
        POST_PROBEBLOCK_MIDDLE_MEM(0, MEMORY_API_FREE, ptr);
        POST_PROBEBLOCK_CALLSTACK();
+       
+       PREPARE_LOCAL_BUF();
+       PACK_COMMON_BEGIN(MSG_PROBE_MEMORY, LC_MEMORY, "pp", ptr, &nothrow);
+       PACK_COMMON_END(0, newerrno, blockresult);
+       PACK_MEMORY(0, MEMORY_API_FREE, ptr);
+       FLUSH_LOCAL_BUF();
+       
        POST_PROBEBLOCK_END();
 }
 
@@ -246,6 +288,13 @@ void operator delete[](void *ptr, const std::nothrow_t& nothrow) throw()
        POST_PROBEBLOCK_BEGIN_MEM(LC_MEMORY, "delete", VT_NULL, NULL, "%p", ptr);
        POST_PROBEBLOCK_MIDDLE_MEM(0, MEMORY_API_FREE, ptr);
        POST_PROBEBLOCK_CALLSTACK();
+               
+       PREPARE_LOCAL_BUF();
+       PACK_COMMON_BEGIN(MSG_PROBE_MEMORY, LC_MEMORY, "pp", ptr, &nothrow);
+       PACK_COMMON_END(0, newerrno, blockresult);
+       PACK_MEMORY(0, MEMORY_API_FREE, ptr);
+       FLUSH_LOCAL_BUF();
+       
        POST_PROBEBLOCK_END();
 }