+
+struct tm format_timestamp(uint64_t timestamp)
+{
+ struct tm tm;
+ uint64_t ts_sec = 0, ts_nsec;
+ time_t time_s;
+
+ ts_nsec = timestamp;
+ ts_sec += ts_nsec / NSEC_PER_SEC;
+ ts_nsec = ts_nsec % NSEC_PER_SEC;
+
+ time_s = (time_t) ts_sec;
+
+ localtime_r(&time_s, &tm);
+
+ return tm;
+}
+
+int *lookup_tid_list(int tid)
+{
+ if (!tid_list)
+ return NULL;
+
+ return g_hash_table_lookup(tid_list, (gpointer) &tid);
+}
+
+char *lookup_hostname_list(const char *hostname)
+{
+ if (!hostname || !hostname_list)
+ return NULL;
+
+ return g_hash_table_lookup(hostname_list, (gpointer) hostname);
+}
+
+int *lookup_filter_tid_list(int tid)
+{
+ return g_hash_table_lookup(global_filter_list, (gpointer) &tid);
+}
+
+void add_filter_tid_list(int tid, struct processtop *newproc)
+{
+ unsigned long *hash_tid;
+
+ hash_tid = malloc(sizeof(unsigned long));
+ *hash_tid = tid;
+ g_hash_table_insert(global_filter_list,
+ (gpointer) (unsigned long) hash_tid, newproc);
+}
+
+void remove_filter_tid_list(int tid)
+{
+ g_hash_table_remove(global_filter_list,
+ (gpointer) (unsigned long) &tid);
+}