Merged nuttx/apps into master

This commit is contained in:
ziggurat29 2016-07-13 09:05:40 -05:00
commit 5fd07644c1
2 changed files with 21 additions and 6 deletions

View File

@ -154,18 +154,18 @@ cJSON *cJSON_GetObjectItem(cJSON *object, const char *string);
* Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds.
*/
const char *cJSON_GetErrorPtr();
const char *cJSON_GetErrorPtr(void);
/* These calls create a cJSON item of the appropriate type. */
cJSON *cJSON_CreateNull();
cJSON *cJSON_CreateTrue();
cJSON *cJSON_CreateFalse();
cJSON *cJSON_CreateNull(void);
cJSON *cJSON_CreateTrue(void);
cJSON *cJSON_CreateFalse(void);
cJSON *cJSON_CreateBool(int b);
cJSON *cJSON_CreateNumber(double num);
cJSON *cJSON_CreateString(const char *string);
cJSON *cJSON_CreateArray();
cJSON *cJSON_CreateObject();
cJSON *cJSON_CreateArray(void);
cJSON *cJSON_CreateObject(void);
/* These utilities create an Array of count items. */

View File

@ -132,8 +132,10 @@ static const char g_sigmask[] = "SigMask:";
#if !defined(CONFIG_NSH_DISABLE_PSSTACKUSAGE)
static const char g_stacksize[] = "StackSize:";
#ifdef CONFIG_STACK_COLORATION
static const char g_stackused[] = "StackUsed:";
#endif
#endif
/****************************************************************************
* Private Functions
@ -268,8 +270,10 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath,
int i;
#if !defined(CONFIG_NSH_DISABLE_PSSTACKUSAGE)
uint32_t stack_size;
#ifdef CONFIG_STACK_COLORATION
uint32_t stack_used;
uint32_t stack_filled;
#endif
#endif
/* Task/thread entries in the /proc directory will all be (1) directories
@ -391,7 +395,9 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath,
/* Get the StackSize and StackUsed */
stack_size = 0;
#ifdef CONFIG_STACK_COLORATION
stack_used = 0;
#endif
filepath = NULL;
ret = asprintf(&filepath, "%s/%s/stack", dirpath, entryp->d_name);
@ -444,16 +450,20 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath,
{
stack_size = (uint32_t)atoi(&line[12]);
}
#ifdef CONFIG_STACK_COLORATION
else if (strncmp(line, g_stackused, strlen(g_stackused)) == 0)
{
stack_used = (uint32_t)atoi(&line[12]);
}
#endif
}
while (nextline != NULL);
}
}
nsh_output(vtbl, "%6.6u ", (unsigned int)stack_size);
#ifdef CONFIG_STACK_COLORATION
nsh_output(vtbl, "%6.6u ", (unsigned int)stack_used);
stack_filled = 0;
@ -470,6 +480,7 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath,
stack_filled / 10, stack_filled % 10,
(stack_filled >= 10 * 80 ? "!" : " "));
#endif
#endif
#ifdef NSH_HAVE_CPULOAD
/* Get the CPU load */
@ -572,11 +583,15 @@ int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_DISABLE_SIGNALS
nsh_output(vtbl, "%-8s ", "SIGMASK");
#endif
#if !defined(CONFIG_NSH_DISABLE_PSSTACKUSAGE)
nsh_output(vtbl, "%6s ", "STACK");
#ifdef CONFIG_STACK_COLORATION
nsh_output(vtbl, "%6s ", "USED");
nsh_output(vtbl, "%7s ", "FILLED");
#endif
#endif
#ifdef NSH_HAVE_CPULOAD
nsh_output(vtbl, "%6s ", "CPU");
#endif