20 #include "sysconfig.h" 33 #ifndef GSC_KERNEL_MESSAGEOUT_MEMORY_SIZE 34 #define GSC_KERNEL_MESSAGEOUT_MEMORY_SIZE (1024 * 3) 38 #ifndef GSC_MAX_TASK_INFO_NUM 39 #define GSC_MAX_TASK_INFO_NUM 10 45 static int task_top(
int argc,
uchar *argv[])
51 unsigned long sum_time;
53 if(argv[1][0] ==
's') {
61 for(i=0; i<count; i++) {
66 if(
cwait(1000) != 0) {
77 for(i=0; i<count; i++) {
78 sum_time += (ti->
run_time - last_run_time[i]);
90 tprintf(
"PID TASK-NAME PRI RUN-TIME(us) %%CPU\n");
91 for(i=0; i<count; i++) {
93 unsigned long long percent = 0;
95 percent = ((
unsigned long long)run_time * 10000) / sum_time;
97 tprintf(
"%3d %15s %3d %10ld %3ld.%02ld\n",
99 (
unsigned long)percent/100, (
unsigned long)percent%100);
114 .usage_str =
"top [\"s\"(scroll)]",
115 .manual_str =
"Print task load" 119 static int task_list(
int argc,
uchar *argv[])
121 unsigned int mess_len;
126 cputs(kmess_buff, mess_len);
136 .command = task_list,
137 .manual_str =
"Print task list" 141 static int task_queue(
int argc,
uchar *argv[])
143 unsigned int mess_len;
148 cputs(kmess_buff, mess_len);
158 .command = task_queue,
159 .manual_str =
"Print task queue" 163 static int command_task_kill(
int argc,
uchar *argv[]);
170 .command = command_task_kill,
171 .usage_str =
"<PID>",
172 .manual_str =
"Kill task" 175 static int command_task_kill(
int argc,
uchar *argv[])
178 print_command_usage(&com_task_kill);
189 #ifdef GSC_KERNEL_ENABLE_CALLTRACE 190 static int command_call_trace(
int argc,
uchar *argv[])
192 unsigned int mess_len;
197 cputs(kmess_buff, mess_len);
209 .command = command_call_trace,
210 .manual_str =
"Print calltrace" 220 #ifdef GSC_KERNEL_ENABLE_CALLTRACE 228 .manual_str =
"Task operation commands",
229 .sublist = com_task_com_list
unsigned char uchar
GadgetSeedの文字(列)は unsigned char 型となる
static const struct st_shell_command com_task_queue
各タスクキューに登録されているタスクを表示する
int cputs(unsigned char *str, unsigned int count)
標準出力より文字列を出力する
void task_kill(int id)
指定したタスクを終了する
static const struct st_shell_command com_task_list
実行中タスクの状態を表示する
int cgetcnw(unsigned char *rd)
標準入力より1文字を取得する(待ち無し)
int dstoi(uchar *str)
10進数文字列 int 変換
static const struct st_shell_command com_task_kill
任意のタスクを終了させる
int tprintf(const char *fmt,...)
簡易printf
unsigned int set_kernel_message_out_mem(unsigned char *mp, unsigned int size)
カーネルメッセージ出力メモリアドレスを設定する
#define GSC_MAX_TASK_INFO_NUM
$gsc topコマンドで表示可能な最大タスク数
static const struct st_shell_command com_task_top
実行中タスクのCPU使用率を表示する
char name[TASK_NAME_LEN+1]
タスク名文字列
int cwait(unsigned int timeout)
標準入力より入力を待つ
unsigned int run_time
タスク実行時間
#define GSC_KERNEL_MESSAGEOUT_MEMORY_SIZE
$gsc カーネルメッセージ出力メモリサイズ