Changeset 25012
- Timestamp:
- 04/17/08 18:04:18 (7 months ago)
- Location:
- haiku/trunk/src/apps/activitymonitor
- Files:
-
- 2 added
- 7 modified
-
ActivityView.cpp (modified) (6 diffs)
-
ActivityView.h (modified) (2 diffs)
-
DataSource.cpp (modified) (2 diffs)
-
DataSource.h (modified) (1 diff)
-
Jamfile (modified) (1 diff)
-
SystemInfo.cpp (modified) (3 diffs)
-
SystemInfo.h (modified) (3 diffs)
-
SystemInfoHandler.cpp (added)
-
SystemInfoHandler.h (added)
Legend:
- Unmodified
- Added
- Removed
-
haiku/trunk/src/apps/activitymonitor/ActivityView.cpp
r25009 r25012 22 22 #include "DataSource.h" 23 23 #include "SystemInfo.h" 24 #include "SystemInfoHandler.h" 24 25 25 26 … … 168 169 { 169 170 delete fOffscreen; 171 delete fSystemInfoHandler; 170 172 } 171 173 … … 183 185 fLastRefresh = 0; 184 186 fDrawResolution = 1; 187 188 fSystemInfoHandler = new SystemInfoHandler; 185 189 186 190 if (settings == NULL … … 350 354 ActivityView::AttachedToWindow() 351 355 { 356 Looper()->AddHandler(fSystemInfoHandler); 357 fSystemInfoHandler->StartWatchingStuff(); 352 358 BMessage refresh(kMsgRefresh); 353 359 fRunner = new BMessageRunner(this, &refresh, fRefreshInterval); … … 360 366 ActivityView::DetachedFromWindow() 361 367 { 368 fSystemInfoHandler->StopWatchingStuff(); 369 Looper()->RemoveHandler(fSystemInfoHandler); 362 370 delete fRunner; 363 371 } … … 739 747 ActivityView::_Refresh() 740 748 { 741 SystemInfo info ;749 SystemInfo info(fSystemInfoHandler); 742 750 743 751 // TODO: run refresh in another thread to decouple it from the UI! -
haiku/trunk/src/apps/activitymonitor/ActivityView.h
r25009 r25012 15 15 class BMessageRunner; 16 16 class DataSource; 17 class SystemInfoHandler; 17 18 struct data_item; 18 19 … … 99 100 int32 fDrawResolution; 100 101 bool fShowLegend; 102 SystemInfoHandler* fSystemInfoHandler; 101 103 }; 102 104 -
haiku/trunk/src/apps/activitymonitor/DataSource.cpp
r25011 r25012 22 22 new ThreadsDataSource(), 23 23 new TeamsDataSource(), 24 new RunningAppsDataSource(), 24 25 new CPUUsageDataSource(), 25 26 new CPUCombinedUsageDataSource(), … … 523 524 bool 524 525 TeamsDataSource::AdaptiveScale() const 526 { 527 return true; 528 } 529 530 531 // #pragma mark - 532 533 534 RunningAppsDataSource::RunningAppsDataSource() 535 { 536 SystemInfo info; 537 538 fMinimum = 0; 539 fMaximum = info.MaxRunningApps(); 540 541 fColor = (rgb_color){100, 150, 255}; 542 } 543 544 545 RunningAppsDataSource::~RunningAppsDataSource() 546 { 547 } 548 549 550 DataSource* 551 RunningAppsDataSource::Copy() const 552 { 553 return new RunningAppsDataSource(*this); 554 } 555 556 557 int64 558 RunningAppsDataSource::NextValue(SystemInfo& info) 559 { 560 return info.UsedRunningApps(); 561 } 562 563 564 const char* 565 RunningAppsDataSource::Label() const 566 { 567 return "Running Applications"; 568 } 569 570 571 bool 572 RunningAppsDataSource::AdaptiveScale() const 525 573 { 526 574 return true; -
haiku/trunk/src/apps/activitymonitor/DataSource.h
r25011 r25012 142 142 143 143 144 class RunningAppsDataSource : public DataSource { 145 public: 146 RunningAppsDataSource(); 147 virtual ~RunningAppsDataSource(); 148 149 virtual DataSource* Copy() const; 150 151 virtual int64 NextValue(SystemInfo& info); 152 virtual const char* Label() const; 153 virtual bool AdaptiveScale() const; 154 }; 155 156 144 157 class CPUUsageDataSource : public DataSource { 145 158 public: -
haiku/trunk/src/apps/activitymonitor/Jamfile
r25009 r25012 12 12 DataSource.cpp 13 13 SystemInfo.cpp 14 SystemInfoHandler.cpp 14 15 15 16 : be tracker $(TARGET_LIBSTDC++) $(TARGET_NETWORK_LIBS) -
haiku/trunk/src/apps/activitymonitor/SystemInfo.cpp
r25011 r25012 6 6 7 7 #include "SystemInfo.h" 8 #include "SystemInfoHandler.h" 8 9 9 10 #include <net/if.h> … … 15 16 16 17 17 SystemInfo::SystemInfo( )18 SystemInfo::SystemInfo(SystemInfoHandler *handler) 18 19 : 19 20 fTime(system_time()), 20 fRetrievedNetwork(false) 21 fRetrievedNetwork(false), 22 fRunningApps(0) 21 23 { 22 24 get_system_info(&fSystemInfo); 25 26 if (handler) { 27 fRunningApps = handler->RunningApps(); 28 } 23 29 } 24 30 … … 105 111 uint32 106 112 SystemInfo::MaxTeams() const 113 { 114 return fSystemInfo.max_teams; 115 } 116 117 118 uint32 119 SystemInfo::UsedRunningApps() const 120 { 121 return fRunningApps; 122 } 123 124 125 uint32 126 SystemInfo::MaxRunningApps() const 107 127 { 108 128 return fSystemInfo.max_teams; -
haiku/trunk/src/apps/activitymonitor/SystemInfo.h
r25011 r25012 9 9 #include <OS.h> 10 10 11 class SystemInfoHandler; 12 11 13 12 14 class SystemInfo { 13 15 public: 14 SystemInfo( );16 SystemInfo(SystemInfoHandler *handler=NULL); 15 17 ~SystemInfo(); 16 18 … … 31 33 uint32 MaxTeams() const; 32 34 35 uint32 UsedRunningApps() const; 36 uint32 MaxRunningApps() const; 37 33 38 bigtime_t Time() const { return fTime; } 34 39 uint32 CPUCount() const { return fSystemInfo.cpu_count; } … … 46 51 uint64 fBytesReceived; 47 52 uint64 fBytesSent; 53 uint32 fRunningApps; 48 54 }; 49 55
