aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>2011-05-10 16:54:21 +0300
committerArjan van de Ven <arjan@linux.intel.com>2011-05-11 00:04:39 -0400
commita2cdd5f37b9704415fdc133ea13e2d22dacf6a7e (patch)
tree88089f19fcca79342f9519b17262ab21aa36a996
parentcaeb59dc8de5378da2a9a8f10bd916e8976027a6 (diff)
downloadpowertop-a2cdd5f37b9704415fdc133ea13e2d22dacf6a7e.tar.gz
process/interrupt: Introduce clear_interrupts() function to free allocated memory
Introduce extern clear_interrupts() function in order to free allocated for all_interrupts memory. We can call it from do_process instead of iterating through all_interrupts. Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
-rw-r--r--process/interrupt.cpp9
-rw-r--r--process/interrupt.h7
2 files changed, 11 insertions, 5 deletions
diff --git a/process/interrupt.cpp b/process/interrupt.cpp
index 46bd76d..85e1bea 100644
--- a/process/interrupt.cpp
+++ b/process/interrupt.cpp
@@ -108,3 +108,12 @@ void all_interrupts_to_all_power(void)
if (all_interrupts[i]->accumulated_runtime)
all_power.push_back(all_interrupts[i]);
}
+
+void clear_interrupts(void)
+{
+ std::vector<class interrupt *>::iterator it = all_interrupts.begin();
+ while (it != all_interrupts.end()) {
+ delete *it;
+ it = all_interrupts.erase(it);
+ }
+}
diff --git a/process/interrupt.h b/process/interrupt.h
index 900d689..cf71d72 100644
--- a/process/interrupt.h
+++ b/process/interrupt.h
@@ -47,7 +47,6 @@ public:
virtual const char * name(void) { return "interrupt"; };
virtual const char * type(void) { return "Interrupt"; };
-
};
extern vector <class interrupt *> all_interrupts;
@@ -56,8 +55,6 @@ extern const char* softirqs[];
extern class interrupt * find_create_interrupt(const char *_handler, int nr, int cpu);
extern void all_interrupts_to_all_power(void);
+extern void clear_interrupts(void);
-
-
-
-#endif \ No newline at end of file
+#endif