Ext.namespace("Zarafa.plugins.zperformance");
Zarafa.plugins.zperformance.ZPerformancePlugin=Ext.extend(Zarafa.core.Plugin,{measureStore:function(a,b,c){var e=[],h=function(d){Ext.isDate(d.startdate)&&e.push((new Date).getTime()-d.startdate.getTime());if(c--){d.startdate=new Date;d.load(b)}else{for(var g=0,f=0;f<e.length;f++)g+=e[f];console.log(g/e.length+"ms");d.un("load",h);d.destroy()}};a.on("load",h);a.load(b)},measureHierarchy:function(a){this.measureStore(new Zarafa.hierarchy.data.HierarchyStore({standalone:false}),{actionType:Zarafa.core.Actions.list},
a)},measureCalendarFolder:function(a){var b=new Zarafa.calendar.AppointmentStore({standalone:false}),c=container.getHierarchyStore().getDefaultFolder("calendar");this.measureStore(b,{folder:[c]},a)},measureContactFolder:function(a){var b=new Zarafa.contact.ContactStore({standalone:false}),c=container.getHierarchyStore().getDefaultFolder("contact");this.measureStore(b,{folder:[c]},a)},measureInboxFolder:function(a){var b=new Zarafa.mail.MailStore({standalone:false}),c=container.getHierarchyStore().getDefaultFolder("inbox");
this.measureStore(b,{folder:[c]},a)},measureNoteFolder:function(a){var b=new Zarafa.note.NoteStore({standalone:false}),c=container.getHierarchyStore().getDefaultFolder("note");this.measureStore(b,{folder:[c]},a)},measureTaskFolder:function(a){var b=new Zarafa.task.TaskStore({standalone:false}),c=container.getHierarchyStore().getDefaultFolder("task");this.measureStore(b,{folder:[c]},a)},measureAddressBook:function(a){this.measureStore(new Zarafa.addressbook.AddressBookStore({standalone:false}),{actionType:Zarafa.core.Actions.list,
params:{subActionType:Zarafa.core.Actions.globaladdressbook}},a)},measureAddressBookHierarchy:function(a){this.measureStore(new Zarafa.addressbook.AddressBookHierarchyStore({standalone:false}),{actionType:Zarafa.core.Actions.list,params:{subActionType:"hierarchy",gab:"all"}},a)},measureReminders:function(a){this.measureStore(new Zarafa.common.reminder.data.ReminderStore({standalone:false}),{actionType:Zarafa.core.Actions.list},a)}});
Zarafa.onReady(function(){container.registerPlugin(new Zarafa.core.PluginMetaData({name:"zperformance",displayName:_("ZPerformance"),pluginConstructor:Zarafa.plugins.zperformance.ZPerformancePlugin}))});
