Lines Matching defs:drv

52 int tiwlan_profile_create (tiwlan_net_dev_t *drv)
54 drv->fpro [0] = NULL;
55 drv->fpro [1] = NULL;
56 drv->fpro [2] = NULL;
57 drv->fpro [3] = NULL;
58 drv->fpro [4] = tiwlan_profile_memory_alloc;
59 drv->fpro [5] = tiwlan_profile_memory_free;
60 drv->fpro [6] = tiwlan_profile_timer_create;
61 drv->fpro [7] = tiwlan_profile_timer_destroy;
62 drv->fpro [8] = tiwlan_profile_buf_alloc;
64 drv->cpu_usage_estimator_start_time = 0;
65 drv->cpu_usage_estimator_stop_time = 0;
66 drv->max_heap_bytes_allocated = 0;
67 drv->max_buf_bytes_allocated = 0;
68 drv->cur_heap_bytes_allocated = 0;
69 drv->max_number_of_timers = 0;
70 drv->cur_number_of_timers = 0;
77 int tiwlan_profile (tiwlan_net_dev_t *drv, unsigned bm, unsigned par)
79 if (drv && bm < MAX_PROFILE_BM && drv->fpro [bm])
81 (*drv->fpro [bm]) (drv, par);
91 tiwlan_net_dev_t * drv = (tiwlan_net_dev_t *) os;
93 if (drv != NULL)
96 drv->bus_driver_entry_start_time = os_timeStampUs (drv);
104 tiwlan_net_dev_t * drv = (tiwlan_net_dev_t *) os;
107 if (drv != NULL)
110 current_entry_cpu_usage = os_timeStampUs (drv) - drv->bus_driver_entry_start_time;
116 __FUNCTION__, drv->bus_driver_entry_start_time, current_entry_cpu_usage);
121 drv->total_us_of_bus_access_cpu_time += current_entry_cpu_usage;
130 tiwlan_net_dev_t * drv = (tiwlan_net_dev_t *) os;
132 if (drv != NULL)
134 drv->driver_entry_start_time = os_timeStampUs (drv);
142 tiwlan_net_dev_t * drv = (tiwlan_net_dev_t *) os;
145 if (drv == NULL)
149 driver_entry_end_time = os_timeStampUs (drv);
152 current_entry_cpu_usage = driver_entry_end_time - drv->driver_entry_start_time;
158 __FUNCTION__, drv->driver_entry_start_time, driver_entry_end_time, current_entry_cpu_usage);
163 drv->total_us_of_cpu_time += current_entry_cpu_usage;
170 tiwlan_net_dev_t * drv = (tiwlan_net_dev_t *) os;
172 if (drv != NULL)
175 drv->cur_heap_bytes_allocated += size;
177 if (drv->max_heap_bytes_allocated < drv->cur_heap_bytes_allocated)
179 drv->max_heap_bytes_allocated = drv->cur_heap_bytes_allocated;
187 tiwlan_net_dev_t * drv = (tiwlan_net_dev_t *) os;
189 if (drv != NULL)
192 drv->cur_heap_bytes_allocated -= size;
194 if ((int)drv->cur_heap_bytes_allocated < 0)
197 __FUNCTION__, size, drv->cur_heap_bytes_allocated);
198 drv->cur_heap_bytes_allocated = 0;
206 tiwlan_net_dev_t * drv = (tiwlan_net_dev_t *) os;
208 if (drv != NULL)
210 drv->max_buf_bytes_allocated += size;
217 tiwlan_net_dev_t * drv = (tiwlan_net_dev_t *) os;
219 if (drv)
222 drv->cur_number_of_timers ++;
224 if (drv->max_number_of_timers < drv->cur_number_of_timers)
226 drv->max_number_of_timers = drv->cur_number_of_timers;
234 tiwlan_net_dev_t * drv = (tiwlan_net_dev_t *) os;
236 if (drv)
239 drv->cur_number_of_timers --;
248 int tiwlan_profile_cpu_usage_estimator_start (tiwlan_net_dev_t * drv, unsigned int resolution)
254 drv->total_us_of_cpu_time = 0;
255 drv->total_us_of_bus_access_cpu_time = 0;
256 drv->cpu_usage_estimator_start_time = os_timeStampUs (drv);
257 drv->cpu_usage_estimator_stop_time = 0;
260 drv->cpu_usage_estimator_resolution = resolution;
263 drv->fpro [0] = tiwlan_profile_driver_entry_start;
264 drv->fpro [1] = tiwlan_profile_driver_entry_end;
265 drv->fpro [2] = tiwlan_profile_bus_access_start;
266 drv->fpro [3] = tiwlan_profile_bus_access_end;
276 int tiwlan_profile_cpu_usage_estimator_stop (tiwlan_net_dev_t * drv)
278 drv->cpu_usage_estimator_stop_time = os_timeStampUs (drv);
281 drv->fpro [0] = NULL;
282 drv->fpro [1] = NULL;
283 drv->fpro [2] = NULL;
284 drv->fpro [3] = NULL;
294 int tiwlan_profile_cpu_usage_estimator_reset (tiwlan_net_dev_t * drv)
297 drv->total_us_of_cpu_time = 0;
298 drv->total_us_of_bus_access_cpu_time = 0;
299 drv->cpu_usage_estimator_start_time = 0;
300 drv->cpu_usage_estimator_stop_time = 0;
307 int tiwlan_profile_report (tiwlan_net_dev_t *drv)
313 printk ("\nMaximum Heap Memory Allocated: %u (bytes)", drv->max_heap_bytes_allocated);
314 printk ("\nCurrent Heap Memory Allocated: %u (bytes)", drv->cur_heap_bytes_allocated);
315 printk ("\nBuffer Memory Allocated: %u (bytes)", drv->max_buf_bytes_allocated);
316 printk ("\nFirmware Image Memory Allocated: %u (bytes)", (unsigned)drv->firmware_image.size);
317 printk ("\nEEPROM Image Memory Allocated: %u (bytes)", (unsigned)drv->eeprom_image.size);
318 printk ("\nMaximum Active Timers: %u", drv->max_number_of_timers);
319 printk ("\nCurrent Active Timers: %u", drv->cur_number_of_timers);
322 if (drv->cpu_usage_estimator_stop_time != 0)
324 total_time = drv->cpu_usage_estimator_stop_time - drv->cpu_usage_estimator_start_time;
330 drv_cpu_usage = drv->total_us_of_cpu_time / total_time;
331 bus_cpu_usage = drv->total_us_of_bus_access_cpu_time / total_time;
334 printk ("\nTotal Driver Run Time: %u (usec)", drv->total_us_of_cpu_time);
335 printk ("\nTotal Bus Access Time: %u (usec)", drv->total_us_of_bus_access_cpu_time);