| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BIN_VMSTATS_IMPL_H_ | 5 #ifndef BIN_VMSTATS_IMPL_H_ |
| 6 #define BIN_VMSTATS_IMPL_H_ | 6 #define BIN_VMSTATS_IMPL_H_ |
| 7 | 7 |
| 8 #include "bin/vmstats.h" | 8 #include "bin/vmstats.h" |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 | 11 |
| 12 #include "bin/isolate_data.h" | 12 #include "bin/isolate_data.h" |
| 13 #include "platform/thread.h" | 13 #include "platform/thread.h" |
| 14 | 14 |
| 15 // VmStats is a HTTP singleton service that reports status information | 15 // VmStats is a HTTP singleton service that reports status information |
| 16 // of the running VM. | 16 // of the running VM. |
| 17 | 17 |
| 18 class VmStats { | 18 class VmStats { |
| 19 public: | 19 public: |
| 20 static void Start(int port, const char* root_dir); | 20 static void Initialize(); |
| 21 |
| 22 static void Start(int port, const char* root_dir, bool verbose); |
| 21 static void Stop(); | 23 static void Stop(); |
| 22 | 24 |
| 23 // Add and remove functions for the isolate_table, called by main.cc. | 25 // Add and remove functions for the isolate_table, called by main.cc. |
| 24 static void AddIsolate(IsolateData* isolate_data, Dart_Isolate isolate); | 26 static void AddIsolate(IsolateData* isolate_data, Dart_Isolate isolate); |
| 25 static void RemoveIsolate(IsolateData* isolate_data); | 27 static void RemoveIsolate(IsolateData* isolate_data); |
| 26 | 28 |
| 29 // Print stack traces of current isolates to stdout. |
| 30 static void DumpStack(); |
| 31 |
| 27 private: | 32 private: |
| 28 VmStats() : root_directory_(NULL), running_(false), bind_address_(0) {} | 33 explicit VmStats(bool verbose) : |
| 34 root_directory_(NULL), running_(false), bind_address_(0) { |
| 35 verbose_ = verbose; |
| 36 } |
| 29 | 37 |
| 38 static void StartServer(int port, const char* root_dir); |
| 30 static void WebServer(uword bind_address); | 39 static void WebServer(uword bind_address); |
| 31 static void Shutdown(); | 40 static void Shutdown(); |
| 41 static void DumpStackThread(uword unused); |
| 32 | 42 |
| 33 // Status text generators. | 43 // Status text generators. |
| 34 char* IsolatesStatus(); | 44 char* IsolatesStatus(); |
| 35 | 45 |
| 36 typedef std::map<IsolateData*, Dart_Isolate> IsolateTable; | 46 typedef std::map<IsolateData*, Dart_Isolate> IsolateTable; |
| 37 | 47 |
| 38 const char* root_directory_; | 48 const char* root_directory_; |
| 39 IsolateTable isolate_table_; | 49 IsolateTable isolate_table_; |
| 40 bool running_; | 50 bool running_; |
| 41 int64_t bind_address_; | 51 int64_t bind_address_; |
| 52 bool verbose_; |
| 42 | 53 |
| 43 static VmStats* instance_; | 54 static VmStats* instance_; |
| 44 static dart::Monitor* instance_monitor_; | 55 static dart::Monitor* instance_monitor_; |
| 45 | 56 |
| 46 // Disallow copy constructor. | 57 // Disallow copy constructor. |
| 47 DISALLOW_COPY_AND_ASSIGN(VmStats); | 58 DISALLOW_COPY_AND_ASSIGN(VmStats); |
| 48 }; | 59 }; |
| 49 | 60 |
| 50 | 61 |
| 51 // Status plug-in and linked-list node. | 62 // Status plug-in and linked-list node. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 99 |
| 89 static VmStatusService* instance_; | 100 static VmStatusService* instance_; |
| 90 static dart::Mutex* mutex_; | 101 static dart::Mutex* mutex_; |
| 91 | 102 |
| 92 VmStatusPlugin* registered_plugin_list_; | 103 VmStatusPlugin* registered_plugin_list_; |
| 93 | 104 |
| 94 DISALLOW_COPY_AND_ASSIGN(VmStatusService); | 105 DISALLOW_COPY_AND_ASSIGN(VmStatusService); |
| 95 }; | 106 }; |
| 96 | 107 |
| 97 #endif // BIN_VMSTATS_IMPL_H_ | 108 #endif // BIN_VMSTATS_IMPL_H_ |
| OLD | NEW |