Kodi Singleton trace
#1
I'm new to Kodi and I was surprised to see how many singletons are used.

So as an experiment, I added printfs to show the first call to each singleton's GetInstance() method and to print out it's size.

I think it's interesting as an introduction to how kodi gets initialized. Platform is Linux, fetch was from Friday (58142ec7b), all I did was started kodi.bin and then shutdown:

before main() gets called:
SINGLETON GlobalsSingleton CAdvancedSettings 1760
SINGLETON GlobalsSingleton CLog 80
SINGLETON GlobalsSingleton CCharsetConverter 8
SINGLETON GlobalsSingleton CLangInfo 352
SINGLETON GlobalsSingleton CApplication 1392
SINGLETON Clibcdio 112
SINGLETON GlobalsSingleton CGraphicContext 840
SINGLETON GlobalsSingleton GUIFontManager 176
SINGLETON GlobalsSingleton CWeather 408
SINGLETON GlobalsSingleton CWinSystemX11GL 448
SINGLETON GlobalsSingleton CGUIWindowManager 368
SINGLETON GlobalsSingleton CFreeTypeLibrary 16
SINGLETON GlobalsSingleton CFDEventMonitor 848
SINGLETON GlobalsSingleton CSectionLoader 80
SINGLETON CAnnouncementManager 80
main: START
main: about to call g_advancedSettings.Initialize()
main: about to call appParamParser.Parse()
SINGLETON CApplicationMessenger 256
main: about to call XBMC_Run()
XBMC_Run: START
XBMC_Run: about to call g_application.Create()
SINGLETON CActiveAEDSP 1304
SINGLETON CDisplaySettings 224
SINGLETON CWakeOnAccess 112
SINGLETON CAddonMgr 304
SINGLETON CProfilesManager 104
SINGLETON CSettings 80
SINGLETON CMediaSourceSettings 160
SINGLETON CPlayerCoreFactory 104
SINGLETON CUPnPSettings 88
SINGLETON CRssManager 144
SINGLETON CMediaSettings 1064
SINGLETON CSkinSettings 104
SINGLETON CViewStateSettings 120
SINGLETON CEventLog (multiple) 128
SINGLETON CSeekHandler 264
SINGLETON CSteroscopicsManager 24
SINGLETON CInputManager 1416
SINGLETON CNetworkServices 72
SINGLETON CPVRManager 1208
SINGLETON CPVRActionListener 8
SINGLETON CDatabaseManager 104
SINGLETON CPeripherals 216
SINGLETON CRepositoryUpdater 1120
SINGLETON CScriptInvocationManager 208
SINGLETON CKeyboardLayoutManager 56
XBMC_Run: about to call g_application.CreateGUI()
SINGLETON CSplash 16
SINGLETON CXbtManager 48
SINGLETON CButtonTranslator 416
SINGLETON CBuiltins 56
SINGLETON CTextureCache 656
SINGLETON CPlayerController 24
XBMC_Run: about to call g_application.Run()
SINGLETON CJobManager 624
SINGLETON CZeroconf 72
SINGLETON CUPnP 64
SINGLETON CEventServer 792
SINGLETON CVideoLibraryQueue 280
SINGLETON CEpgContainer 1304
XBMC_Run: returned from g_application.Run()
Reply
#2
That are really nice informations.

What are you trying to achieve with this thread? Would you help to improve Kodi?
Latest news about AudioDSP and my libraries is available on Twitter.

Developers can follow me on Github.
Reply
#3
@wilser,

Thanks!

The purpose of the thread was to share information: Kodi architecture uses singletons and they are initialized in the above sequence in my recent linux configuration. I think it's interesting as is.

The history is that I initially thought maybe I'd try making CApplication and CAdvancedSettings stack variables, but then when I realized how many singletons there are, it became apparent that this is would be a big task to do properly. So I thought I'd just document what I found.

Is there is interest in re-architecting the singletons into something else? If so I can propose something.

I am interested in helping with Kodi, so I could work on this or work on something else (power management?)
Reply
#4
Hi Spayno,

I'm not the right guy, because I'm currently working on audio stuff. Also AudioDSP is using a singleton and in a future version I will remove it.

Any contribution to Kodi is welcome. If you want you, create a github account and fork our repo. After that you can work on whatever you want and then send us an pull request. Blush

(2015-10-23, 19:17)spayno Wrote: Is there is interest in re-architecting the singletons into something else? If so I can propose something.
For refacturing you should ask FernetMenta. He is very familiar with Kodi's architecture.

(2015-10-23, 19:17)spayno Wrote: I am interested in helping with Kodi, so I could work on this or work on something else (power management?)
I always say start working on something, which you would like to improve or if you miss a feature start working on that. Or share your ideas here in our development section. Currently I don't know your skills, so feel free to ask questions. Maybe I can guide you to the right developers.
Latest news about AudioDSP and my libraries is available on Twitter.

Developers can follow me on Github.
Reply
#5
a refactoring is in progress - even thoug only in small steps. Any help is welcome here. Check out this forum section for the first steps that are done atm http://forum.kodi.tv/forumdisplay.php?fid=240 . FernetMenta is currently killing all globals in order to untangle stuff. After that singletons will be revised, as they are currently used like globals which is nonesens in many cases.
Reply

Logout Mark Read Team Forum Stats Members Help
Kodi Singleton trace0