@@ -404,22 +404,6 @@ void DarwinProcess_setFromLibprocPidinfo(DarwinProcess* proc, DarwinProcessTable
404404 }
405405}
406406
407- static ProcessState stateToChar (int run_state ) {
408- switch (run_state ) {
409- case TH_STATE_RUNNING :
410- return RUNNING ;
411- case TH_STATE_STOPPED :
412- return STOPPED ;
413- case TH_STATE_WAITING :
414- return WAITING ;
415- case TH_STATE_UNINTERRUPTIBLE :
416- return UNINTERRUPTIBLE_WAIT ;
417- case TH_STATE_HALTED :
418- return BLOCKED ;
419- }
420- return UNKNOWN ;
421- }
422-
423407/*
424408 * Scan threads for process state information.
425409 * Based on: http://stackoverflow.com/questions/6788274/ios-mac-cpu-usage-for-thread
@@ -473,7 +457,6 @@ void DarwinProcess_scanThreads(DarwinProcess* dp, DarwinProcessTable* dpt) {
473457
474458 const bool hideUserlandThreads = dpt -> super .super .host -> settings -> hideUserlandThreads ;
475459
476- integer_t run_state = 999 ;
477460 for (mach_msg_type_number_t i = 0 ; i < thread_count ; i ++ ) {
478461
479462 thread_identifier_info_data_t identifer_info ;
@@ -517,16 +500,12 @@ void DarwinProcess_scanThreads(DarwinProcess* dp, DarwinProcessTable* dpt) {
517500 }
518501
519502 DarwinProcess * tdproc = (DarwinProcess * )tprocess ;
520- tdproc -> super .state = stateToChar (extended_info .pth_run_state );
521503 tdproc -> super .percent_cpu = extended_info .pth_cpu_usage / 10.0 ;
522504 tdproc -> stime = extended_info .pth_system_time ;
523505 tdproc -> utime = extended_info .pth_user_time ;
524506 tdproc -> super .time = (extended_info .pth_system_time + extended_info .pth_user_time ) / 10000000 ;
525507 tdproc -> super .priority = extended_info .pth_curpri ;
526508
527- if (extended_info .pth_run_state < run_state )
528- run_state = extended_info .pth_run_state ;
529-
530509 // TODO: depend on setting
531510 const char * name = extended_info .pth_name [0 ] != '\0' ? extended_info .pth_name : proc -> procComm ;
532511 Process_updateCmdline (tprocess , name , 0 , strlen (name ));
@@ -537,9 +516,6 @@ void DarwinProcess_scanThreads(DarwinProcess* dp, DarwinProcessTable* dpt) {
537516
538517 vm_deallocate (mach_task_self (), (vm_address_t ) thread_list , sizeof (thread_port_array_t ) * thread_count );
539518 mach_port_deallocate (mach_task_self (), task );
540-
541- if (run_state != 999 )
542- proc -> state = stateToChar (run_state );
543519}
544520
545521
0 commit comments