{"action":"created","issue":{"url":"https://api.github.com/repos/bebbo/gcc/issues/51","repository_url":"https://api.github.com/repos/bebbo/gcc","labels_url":"https://api.github.com/repos/bebbo/gcc/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/bebbo/gcc/issues/51/comments","events_url":"https://api.github.com/repos/bebbo/gcc/issues/51/events","html_url":"https://github.com/bebbo/gcc/issues/51","id":391852108,"node_id":"MDU6SXNzdWUzOTE4NTIxMDg=","number":51,"title":"gprof: issues with C++ code?","user":{"login":"mheyer32","id":33539855,"node_id":"MDQ6VXNlcjMzNTM5ODU1","avatar_url":"https://avatars3.githubusercontent.com/u/33539855?v=4","gravatar_id":"","url":"https://api.github.com/users/mheyer32","html_url":"https://github.com/mheyer32","followers_url":"https://api.github.com/users/mheyer32/followers","following_url":"https://api.github.com/users/mheyer32/following{/other_user}","gists_url":"https://api.github.com/users/mheyer32/gists{/gist_id}","starred_url":"https://api.github.com/users/mheyer32/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mheyer32/subscriptions","organizations_url":"https://api.github.com/users/mheyer32/orgs","repos_url":"https://api.github.com/users/mheyer32/repos","events_url":"https://api.github.com/users/mheyer32/events{/privacy}","received_events_url":"https://api.github.com/users/mheyer32/received_events","type":"User","site_admin":false},"labels":[{"id":1166672360,"node_id":"MDU6TGFiZWwxMTY2NjcyMzYw","url":"https://api.github.com/repos/bebbo/gcc/labels/please%20test","name":"please test","color":"22ff22","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2018-12-17T19:13:51Z","updated_at":"2018-12-19T21:47:07Z","closed_at":null,"author_association":"NONE","body":"I'm trying -pg with scummvm, but get weird results which I think are already present in the output of gprof.\r\nWhat seems to happen is that the wrong functions get attributed in many places. For instance, i can see a function named 'undrawMouse' in the wrong place in the callgraph (being called by main() and using up high amounts of the time), but that is impossible.\r\n ScummVM makes use of function pointers, virtual functions and templates. Is there a chance any of this is confusing the address->symbol resolve?\r\n\r\nI made sure to use -fno-omit-frame-pointers and passed -pg and -g -ggdb to both, compiler and linker. \r\nI used the same methodology  on ADoom/DoomAttack and seem to get sensible results there.\r\nIt does not seem to matter if I use -O0 or use higher optimization levels.\r\n\r\nIf you need more data/files or instructions on how to reproduce with ScummVM, let me know."},"comment":{"url":"https://api.github.com/repos/bebbo/gcc/issues/comments/448755225","html_url":"https://github.com/bebbo/gcc/issues/51#issuecomment-448755225","issue_url":"https://api.github.com/repos/bebbo/gcc/issues/51","id":448755225,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0ODc1NTIyNQ==","user":{"login":"mheyer32","id":33539855,"node_id":"MDQ6VXNlcjMzNTM5ODU1","avatar_url":"https://avatars3.githubusercontent.com/u/33539855?v=4","gravatar_id":"","url":"https://api.github.com/users/mheyer32","html_url":"https://github.com/mheyer32","followers_url":"https://api.github.com/users/mheyer32/followers","following_url":"https://api.github.com/users/mheyer32/following{/other_user}","gists_url":"https://api.github.com/users/mheyer32/gists{/gist_id}","starred_url":"https://api.github.com/users/mheyer32/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mheyer32/subscriptions","organizations_url":"https://api.github.com/users/mheyer32/orgs","repos_url":"https://api.github.com/users/mheyer32/repos","events_url":"https://api.github.com/users/mheyer32/events{/privacy}","received_events_url":"https://api.github.com/users/mheyer32/received_events","type":"User","site_admin":false},"created_at":"2018-12-19T21:47:07Z","updated_at":"2018-12-19T21:47:07Z","author_association":"NONE","body":"Initial feedback: yes, I needed -Wl,--allow-multiple-definition to avoid the linker complaining about multiple definitions. (That was before your latest patch, need to try again later tonight).\r\nThe callgraphs make ALOT more sense now.\r\nDoes the current fix impact performance beyond the general profiling instrumentation? \r\n\r\nI am currently looking into optimizing the SCI engine (Sierra Games), mostly just booting up Space Quest 1 - The Sarien Encounter (Remake). There's tons of wasted perf by making runtime decisions over and over that are basically constant over the whole game - it would have been better, if they had made it so that there was a specialized engine (via subclassing) per Game instead of cramming it all into the same source and having a ton of  if (getSciVersion() < a) {do X}  else {do Y} everywhere.\r\n\r\nI have quite a few of uncommited changes that speed up things a lot already. The biggest chunk next up would be to speed up drawing. Calling setPixel() for each individual pixel and then doing a _screen[y*width +x]  = color  is truly horrible on a 50Mhz miggie.\r\n\r\nI configure ScummVM this way:\r\n./configure --host=m68k-amigaos --disable-all-engines --enable-engine=scumm,scumm-7-8,sci,tinsel --disable-mt32emu --enable-release --disable-hq-scalers --with-amiga-prefix=/media/sf_Amiga/ScummVM\r\n\r\nThis will allow to play most Lucasfilm and Sierra games as well as Discworld.\r\n\r\nYou NEED to install BlazeWCP on the Amiga, otherwise the C2P conversion will be horribly slow - I'm using WriteChunkyPixels() instead of specialized C2P routines for now... changing that is on the agenda for a rainy day.\r\n\r\nIf you run in an emulator or have a MIDI  equipped Amiga, I highly recommend the CAMD music output plugin! WinUAE supports to 'connect' the emulated machine straight to any Midi device known to Windows (I use MUNT-32 and the built-in general midi synthesizer)\r\n"}}
{"actor":{"display_login":"mheyer32"}}