Changeset faf38b2 in mainline


Ignore:
Timestamp:
2010-04-09T09:41:39Z (14 years ago)
Author:
Stanislav Kozina <stanislav.kozina@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
638927a
Parents:
a325832
Message:

Removed thread selection from kernel.
Now all threads are copied to uspace and then selected.

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/ps/ps.h

    ra325832 rfaf38b2  
    4242extern size_t sys_ps_get_tasks(task_id_t *uspace_ids, size_t size);
    4343extern int sys_ps_get_task_info(task_id_t *uspace_id, task_info_t *uspace_info);
    44 extern int sys_ps_get_threads(task_id_t *uspace_id, thread_info_t *uspace_infos, size_t size);
     44extern int sys_ps_get_threads(thread_info_t *uspace_infos, size_t size);
    4545extern int sys_ps_get_cpu_info(uspace_cpu_info_t *uspace_cpu);
    4646extern int sys_ps_get_mem_info(uspace_mem_info_t *mem_info);
  • kernel/generic/include/ps/taskinfo.h

    ra325832 rfaf38b2  
    7474typedef struct {
    7575        thread_id_t tid;
     76        task_id_t taskid;
    7677        state_t state;
    7778        int priority;
  • kernel/generic/src/ps/ps.c

    ra325832 rfaf38b2  
    4848static size_t count;
    4949static size_t max_count;
    50 static task_t *selected_task;
    5150
    5251#define WRITE_TASK_ID(dst, i, src) copy_to_uspace(dst + i, src, sizeof(task_id_t))
     
    163162        spinlock_lock(&t->lock);
    164163
    165         if (t->task != selected_task) {
    166                 spinlock_unlock(&t->lock);
    167                 return true;
    168         }
    169 
    170164        ++count;
    171165        if (count > max_count) {
     
    175169       
    176170        result.tid = t->tid;
     171        ASSERT(t->task);
     172        result.taskid = t->task->taskid;
    177173        result.state = t->state;
    178174        result.priority = t->priority;
     
    191187}
    192188
    193 int sys_ps_get_threads(task_id_t *uspace_id, thread_info_t *uspace_infos, size_t size)
     189int sys_ps_get_threads(thread_info_t *uspace_infos, size_t size)
    194190{
    195191        ipl_t ipl;
    196192        ipl = interrupts_disable();
    197193
    198         task_id_t id;
    199         copy_from_uspace(&id, uspace_id, sizeof(task_id_t));
    200         spinlock_lock(&tasks_lock);
    201         selected_task = task_find_by_id(id);
    202         spinlock_unlock(&tasks_lock);
    203 
    204         if (!selected_task) {
    205                 return 0;
    206         }
    207 
     194        printf("LIst threads, size: %llu\n", size);
    208195        spinlock_lock(&threads_lock);
    209196
  • uspace/app/ps/ps.c

    ra325832 rfaf38b2  
    9999        int thread_count = THREAD_COUNT;
    100100        thread_info_t *threads = malloc(thread_count * sizeof(thread_info_t));
    101         int result = get_task_threads(taskid, threads, sizeof(thread_info_t) * thread_count);
     101        int result = get_task_threads(threads, sizeof(thread_info_t) * thread_count);
    102102
    103103        while (result > thread_count) {
    104104                thread_count *= 2;
    105105                threads = realloc(threads, thread_count * sizeof(thread_info_t));
    106                 result = get_task_threads(taskid, threads, sizeof(thread_info_t) * thread_count);
     106                result = get_task_threads(threads, sizeof(thread_info_t) * thread_count);
    107107        }
    108108
     
    115115        printf("    ID    State  CPU   Prio    [k]uCycles    [k]kcycles   Cycle fault\n");
    116116        for (i = 0; i < result; ++i) {
     117                if (threads[i].taskid != taskid) {
     118                        continue;
     119                }
    117120                uint64_t ucycles, kcycles;
    118121                char usuffix, ksuffix;
  • uspace/app/top/ps.c

    ra325832 rfaf38b2  
    8686        int thread_count = THREAD_COUNT;
    8787        thread_info_t *threads = malloc(thread_count * sizeof(thread_info_t));
    88         int result = get_task_threads(taskid, threads, sizeof(thread_info_t) * thread_count);
     88        int result = get_task_threads(threads, sizeof(thread_info_t) * thread_count);
    8989
    9090        while (result > thread_count) {
    9191                thread_count *= 2;
    9292                threads = realloc(threads, thread_count * sizeof(thread_info_t));
    93                 result = get_task_threads(taskid, threads, sizeof(thread_info_t) * thread_count);
     93                result = get_task_threads(threads, sizeof(thread_info_t) * thread_count);
    9494        }
    9595       
  • uspace/lib/c/generic/ps.c

    ra325832 rfaf38b2  
    7474 *
    7575 */
    76 int get_task_threads(task_id_t taskid, thread_info_t *infos, size_t size)
     76int get_task_threads(thread_info_t *infos, size_t size)
    7777{
    78         return __SYSCALL3(SYS_PS_GET_THREADS, (sysarg_t) &taskid, (sysarg_t) infos,
    79                         (sysarg_t) size);
     78        return __SYSCALL2(SYS_PS_GET_THREADS, (sysarg_t) infos, (sysarg_t) size);
    8079}
    8180
  • uspace/lib/c/include/ps.h

    ra325832 rfaf38b2  
    4545extern size_t get_task_ids(task_id_t *ids, size_t size);
    4646extern int get_task_info(task_id_t id, task_info_t *info);
    47 extern int get_task_threads(task_id_t taskid, thread_info_t *infos, size_t size);
     47extern int get_task_threads(thread_info_t *infos, size_t size);
    4848
    4949#endif
Note: See TracChangeset for help on using the changeset viewer.