4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Ja-young Gu <jygu@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
31 #include <glib-object.h>
39 #include <communicator.h>
43 /* hacking TcoreQueue */
44 struct tcore_queue_type {
49 static void _monitor_plugin(Server *s)
57 list = tcore_server_ref_plugins(s);
64 msg("Name: [%s]", tcore_plugin_get_description(p)->name);
66 str = tcore_plugin_get_filename(p);
67 msg(" - file: %s", str);
71 msg(" - addr: %p", p);
72 msg(" - userdata: %p", tcore_plugin_ref_user_data(p));
80 static void _monitor_storage(Server *s)
86 msg("-- Storages --");
88 list = tcore_server_ref_storages(s);
95 msg("Name: [%s]", tcore_storage_ref_name(strg));
96 msg(" - addr: %p", strg);
103 static void _monitor_communicator(Server *s)
108 msg("-- Coomunicators --");
110 list = tcore_server_ref_communicators(s);
117 msg("Name: [%s]", tcore_communicator_ref_name(comm));
118 msg(" - addr: %p", comm);
119 msg(" - parent_plugin: %p", tcore_communicator_ref_plugin(comm));
120 msg(" - userdata: %p", tcore_communicator_ref_user_data(comm));
127 static void _monitor_hal(Server *s)
132 TcorePending *pending;
137 unsigned int data_len;
141 list = tcore_server_ref_hals(s);
148 str = tcore_hal_get_name(h);
149 msg("Name: [%s]", str);
150 msg(" - addr: %p", h);
151 msg(" - parent_plugin: %p", tcore_hal_ref_plugin(h));
152 msg(" - userdata: %p", tcore_hal_ref_user_data(h));
154 q = tcore_hal_ref_queue(h);
167 qlen = tcore_queue_get_length(q);
168 msg(" - queue: %p, length: %d", q, qlen);
169 msg(" queue_head: %p", g_queue_peek_head(q->gq));
170 for (i = 0; i < qlen; i++) {
171 pending = g_queue_peek_nth(q->gq, i);
172 msg(" [%02d] pending=%p, id=0x%x, ur=%p", i, pending, tcore_pending_get_id(pending), tcore_pending_ref_user_request(pending));
174 data = tcore_pending_ref_request_data(pending, &data_len);
175 msg(" data=%p, data_len=%d", data, data_len);
177 msg(" queue_tail: %p", g_queue_peek_tail(q->gq));
184 void monitor_server_state(Server *s)
188 _monitor_communicator(s);