Skip to content
Snippets Groups Projects
Commit c89eba60 authored by Vadim Seregin's avatar Vadim Seregin
Browse files

Merge branch 'chernyak/JVET-AF0201' into 'master'

JVET-AF0201: Incorporate decoder memory measurement

See merge request !547
parents cd2e565c b7d61eb9
No related branches found
No related tags found
1 merge request!547JVET-AF0201: Incorporate decoder memory measurement
Pipeline #11314 canceled
...@@ -112,6 +112,14 @@ int main(int argc, char* argv[]) ...@@ -112,6 +112,14 @@ int main(int argc, char* argv[])
} }
#endif #endif
#if JVET_Z0150_MEMORY_USAGE_PRINT
#ifdef __linux
int vm = getProcStatusValue("VmPeak:");
int rm = getProcStatusValue("VmHWM:");
printf("\nMemory Usage: VmPeak= %d KB ( %.1f GiB ), VmHWM= %d KB ( %.1f GiB )\n", vm, (double)vm/(1024*1024), rm, (double)rm/(1024*1024));
#endif
#endif
// ending time // ending time
dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC; dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC;
printf("\n Total Time: %12.3f sec.\n", dResult); printf("\n Total Time: %12.3f sec.\n", dResult);
......
...@@ -77,33 +77,6 @@ static void printMacroSettings() ...@@ -77,33 +77,6 @@ static void printMacroSettings()
} }
} }
#if JVET_Z0150_MEMORY_USAGE_PRINT
#ifdef __linux
#include <cstdlib>
#include <cstdio>
#include <cstring>
int getProcStatusValue(const char* key)
{
FILE* file = fopen("/proc/self/status", "r");
int result = -1;
char line[128];
int len = strlen(key);
while (fgets(line, 128, file) != nullptr)
{
if (strncmp(line, key, len) == 0)
{
result = atoi(line+len);
break;
}
}
fclose(file);
return result;
}
#endif
#endif
// ==================================================================================================================== // ====================================================================================================================
// Main function // Main function
// ==================================================================================================================== // ====================================================================================================================
......
...@@ -1817,6 +1817,29 @@ static inline uint32_t getIndexMappingTableToSortedArray1D(InputValueType (&in)[ ...@@ -1817,6 +1817,29 @@ static inline uint32_t getIndexMappingTableToSortedArray1D(InputValueType (&in)[
} }
#endif #endif
#if JVET_Z0150_MEMORY_USAGE_PRINT
#ifdef __linux
static inline int getProcStatusValue(const char* key)
{
FILE* file = fopen("/proc/self/status", "r");
int result = -1;
char line[128];
int len = strlen(key);
while (fgets(line, 128, file) != nullptr)
{
if (strncmp(line, key, len) == 0)
{
result = atoi(line+len);
break;
}
}
fclose(file);
return result;
}
#endif
#endif
//CASE-BREAK for breakpoints //CASE-BREAK for breakpoints
#if defined ( _MSC_VER ) && defined ( _DEBUG ) #if defined ( _MSC_VER ) && defined ( _DEBUG )
#define _CASE(_x) if(_x) #define _CASE(_x) if(_x)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment