{"id":13730829,"url":"https://github.com/stoyannk/profi","last_synced_at":"2025-05-08T03:31:59.697Z","repository":{"id":9757574,"uuid":"11723989","full_name":"stoyannk/profi","owner":"stoyannk","description":"A light-weight C++ profiling library","archived":false,"fork":false,"pushed_at":"2014-07-09T14:59:54.000Z","size":1457,"stargazers_count":31,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-04T02:09:49.946Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stoyannk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-28T18:42:15.000Z","updated_at":"2023-03-10T21:44:54.000Z","dependencies_parsed_at":"2022-09-24T05:51:28.206Z","dependency_job_id":null,"html_url":"https://github.com/stoyannk/profi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoyannk%2Fprofi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoyannk%2Fprofi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoyannk%2Fprofi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoyannk%2Fprofi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stoyannk","download_url":"https://codeload.github.com/stoyannk/profi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224695723,"owners_count":17354469,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T02:01:20.031Z","updated_at":"2024-11-14T21:31:39.008Z","avatar_url":"https://github.com/stoyannk.png","language":"C++","readme":"profi\n=====\n\nProfi is a very light-weight and fast instrumenting profiling library for C++ applications.\n\nFeatures\n=====\n - Instrumenting profiler\n - Small performance impact while profiling\n - Designed for multithreaded code\n - DLL-friendly\n - Multiple timing functions supported\n - Easy eanbling/disabling the whole profiling facility\n - Multiple profiling granularities\n - JSON result exporter\n - HTML result visualizer\n \nMotivation\n=====\nThere aren't alot of fast, simple, instrumenting and multithreading-friendly profiling libraries around. \n\nA primary goal of profi is to be simple, unobtrusive and fast. Profiling code can be added everywhere and there is no need\nto 'initialize' a thread like in other libraries. The JSON output and HTML page that renders it make analyzing the data easier but\nthere is more work to be done in the HTML to make it more user-friendly for very large data sets. \n\nMultithreaded code is the primary target of profi. \n\nDLL-awareness is also very important because all the projects I work on are broken up in many shared libraries \nat least during development.\n\nAn excellent library that shares many similarities in it's design is the \"High Performance C++ Profiler\" (http://code.google.com/p/high-performance-cplusplus-profiler/).\n\nVisual Studio has a good instrumenting profiler that however will blindly profile all functions. For large projects this might mean too many hard to read \ndata as well as too much slow-down for the application. Profi will be cross-platform soon.\nWith profi you can control and profile just some critical parts of the program. If you are careful when controlling the granularity of the profile it can even \nbe left running in release or production builds because the slow-down will be negligible.\n\nImplementation\n=====\nThe library keeps the profiling stacks of every thread separately to minimize data sharing across threads and hence avoid the need of data locking.\n\nA custom hash map implementation is used to keep track of the prfiling scopes and their respective timers and counters. \nI use a custom hash map because I don't need to delete any data from it ever and this allows me to make a faster and simpler implementation. \n\nWhen a profiling data dump has to be performed, the whole hash map for a scope is copied to minimize locking span. The data is dumped from the copy.\n\nTwo timing methods are supported: QueryPerformanceCounter and rdtsc. \n\nThe library supports CPU flushing when timing. For more details on timing methods please refer to my post in the Coherent Labs blog - http://blog.coherent-labs.com/2013/03/timestamps-for-performance-measurements.html.\n\nRequirements\n=====\nCurrently the library runs on Windows only, mostly because I hadn't time to port it to other platforms - something that should be trivial as the everything was written with\nportability in mind.\n\nTested on MSVC 2012. A C++11 compliant compiler and STL library are required.\nPremake is required to generate the project files.\n\nUsage\n=====\n1. Use premake4 (http://industriousone.com/premake) to generate the project and solution files. \nIn a command prompt in the main folder of profi run \"premake4 vs2012\"\n2. Open the \"profi_all.sln\" solution. Compile the library.\n3. Consult the \"simple\" and \"mt\" sample applications for sample usages of the library.\n4. \"simple\" and \"mt\" dump their data in a file named \"output.json\" in their respective folders. JSON files created by profi \ncan be visualized via the \"visualizer.html\" page in the \"visualizer\" folder. By default it reads a file named \"output.json\" \nin it's working folder. Changing the file it loads is trivial - just edit the HTML file. It works on both Firefox and Chrome \n(for Chrome run it with the --allow-file-access-from-files argument)\n\nThe \"profi_decls.h\" header contains a \"Configuration\" section where the behavior of the library can be customized. \nTo embed the library just include \"profi.h\" and link with it either dynamically ot static.\n\nFuture\n=====\nI plan to port the library at least to Mac \u0026 Linux and keep updating and enhancing it.\nCurrently the profile can't be stopped or it's granularity changed runtime.\nI also hope to have time to expand it one day to be an event-driven library.\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoyannk%2Fprofi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstoyannk%2Fprofi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoyannk%2Fprofi/lists"}