Profiling mfile usage history

3 visualizzazioni (ultimi 30 giorni)
Matt J
Matt J il 14 Mar 2016
Commentato: John D'Errico il 15 Mar 2016
I doubt that this exists, but I thought I'd put this out there in case there are any ideas. I have accumulated a lot of mfiles over time, and have a feeling that some are never used anymore, meaning that I don't call those functions directly and doubt that they are dependencies of any of the functions that I do routinely call either. I would like to be able to weed out these files and archive them, to cut down on the size of the main mfile library that I use for my work. I am wondering therefore if there is some tool out there to track/measure the usage history of mfiles over time, something like a profiler, but which tracks the amount of time mfiles get used/called between MATLAB sessions over a period of months or years. I could then weed out the files that show little or no recent usage.
Any thoughts?

Risposte (1)

John D'Errico
John D'Errico il 14 Mar 2016
I don't think that is something returned to you by anything in MATLAB, so you would need to go to the OS.
You should be able to get a date the file was modified from dir. But usage is different. I don't know if there is a touch time stored for files in general. (We used to use touch on unix, to keep unused files from being automatically migrated off to long term storage, so VERY slow access time. So maybe that information is available.)
Years ago, we tried putting a call in the beginning of each toolbox function (for OUR home grown tools) that updated a file on the server, telling which functions were used. This had value to report to management what usage our tools were getting around the company, as well as which specific tools were most heavily used. The stats were useful at the time, but the penalty was extra time used per function call to maintain that database.
  2 Commenti
Matt J
Matt J il 15 Mar 2016
Yes. Well, as I said in my post, I was pessimistic, but vaguely hopeful since both the command history window and the profile do carry historical information of use. I think it should be a simple matter of carrying some of that information from session to session. I don't know what the overhead of that would be, of course.
John D'Errico
John D'Errico il 15 Mar 2016
Its the kind of thing that would be most easily done by MATLAB. Set a flag of some sort, indicating that statistics are to maintained when any m-file is called, how often, last time called, etc. It could be made directory specific, so only tools from certain given directories are logged in this manner.
So send up a feature request to TMW. It probably won't go anywhere, but you never know. It cannot be that difficult to implement, and if the idea catches the eye of the right person, then it might appear in some future version.

Accedi per commentare.

Categorie

Scopri di più su Entering Commands in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by