{ "id": "115766", "key": "TIMOB-14173", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "15494", "description": "2013 Sprint 12 Core", "name": "2013 Sprint 12 Core", "archived": true, "released": true, "releaseDate": "2013-06-17" }, { "id": "15110", "description": "2013 Sprint 12", "name": "2013 Sprint 12", "archived": true, "released": true, "releaseDate": "2013-06-17" }, { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-11-14T11:22:51.000+0000", "created": "2013-06-10T23:40:21.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "qe-3.1.1" ], "versions": [ { "id": "15478", "description": "Release 3.1.1", "name": "Release 3.1.1", "archived": true, "released": true, "releaseDate": "2013-06-17" } ], "issuelinks": [ { "id": "29469", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "112125", "key": "TIMOB-13342", "fields": { "summary": "Profiler: Android: results are inconsistent and lacking some function calls", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "29617", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "116014", "key": "TIDOC-1179", "fields": { "summary": "Android: Profiler: set correct expectations ", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-11-14T11:22:51.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" }, { "id": "10207", "name": "Tooling" } ], "description": "h5. Problem description\r\n\r\nCode Profiler on Android (both classic and Alloy projects) is returning different inconsistent outputs for every run.\r\n\r\nh6. Sample code:\r\n{code}\r\nfunction doClick(e) {\r\n\tTi.API.info('#### doCLick function ');\r\n\t\r\n\tsetTimeout(function(){\r\n\t\talert('doClick function');\r\n\t}, 2000);\r\n}\r\n\r\nfunction showAlert() {\r\n\tTi.API.info('#### showAlert function ');\r\n\tsetTimeout(function(){\r\n\t\talert('showAlert function');\r\n\t}, 2000);\r\n}\r\n\r\n\r\nvar win = Titanium.UI.createWindow({\r\n\ttitle : 'Tab 1',\r\n\tbackgroundColor : '#fff'\r\n});\r\n\r\nvar label1 = Titanium.UI.createLabel({\r\n\tcolor : '#999',\r\n\ttext : 'I am Window 1',\r\n\tfont : {\r\n\t\tfontSize : '24dp',\r\n\t\tfontFamily : 'Helvetica Neue'\r\n\t},\r\n\ttextAlign : 'center',\r\n\twidth : 'auto'\r\n});\r\nlabel1.addEventListener('click', showAlert);\r\n\r\nwin.add(label1);\r\n\r\nvar button = Ti.UI.createButton({\r\n\tbottom : '10',\r\n\ttitle : 'click'\r\n});\r\nbutton.addEventListener('click', doClick);\r\n\r\n\r\nwin.add(button);\r\nwin.add(label1);\r\n\r\nwin.open();\r\n{code}\r\n\r\n\r\nh6. Steps to reproduce\r\n1. Grab the sample code, Build and run the Code Profiler on Android device (tested with Google Galaxy Nexus 4.2.2)\r\n2. Once the app is started, start recording a snapshot with the Profiler.\r\n3. Click on the Label and wait for the alert to appear('showAlert' function is triggered). The click on the Button and wait for the alert to appear ('doCick' function is triggered). Stop the profiler.\r\n4. See the result - repeat points 1 to 4\r\n\r\nExpected result: 'Performance Profile' section is reporting details about the two name function called ('doClick' and 'showAlert') and the two unnamed functions() being called after the 'setTimer'. Output result is also consistent every time the test is performed.\r\n\r\nResult: outputs are inconsistent and different every time. The two functions (one called 'doClick' and the other one called 'showAlert') are not always present in the output.\r\nAttached some of the outputs I got from my testing. \r\n\r\nh5. Additional notes\r\nNot reproducible on iOS.", "attachment": [ { "id": "39699", "filename": "01_Android_profilerOutput.png", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-11T00:49:48.000+0000", "size": 46904, "mimeType": "image/png" }, { "id": "39698", "filename": "02_Android_profilerOutput.png", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-11T00:49:48.000+0000", "size": 104382, "mimeType": "image/png" }, { "id": "39697", "filename": "03_Android_profilerOutput.png", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-11T00:49:48.000+0000", "size": 51002, "mimeType": "image/png" }, { "id": "39696", "filename": "04_Android_profilerOutput.png", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-11T00:49:48.000+0000", "size": 42887, "mimeType": "image/png" }, { "id": "39695", "filename": "05_Android_profilerOutput.png", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-11T00:49:48.000+0000", "size": 47814, "mimeType": "image/png" }, { "id": "39891", "filename": "codeProfiler_alloyProject.png", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-15T21:33:56.000+0000", "size": 71863, "mimeType": "image/png" }, { "id": "39892", "filename": "codeProfiler_classicProject.png", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-15T21:33:56.000+0000", "size": 88762, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: Profiler: output is inconsistent and incomplete", "creator": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Titanium SDK 3.1.1.v20130610114203\r\nAppcelerator Studio 3.1.1.201306071750\r\nAlloy 1.1.3-cr\r\nCode Processor 1.0.1-cr4\r\nCLI 3.1.1-cr\r\n\r\nAndroid Emulator Google APIs 2.3.3\r\nAndroid Device Samsung Galaxy SIII Mini 4.1.2\r\nAndroid Device Galaxy Nexus 4.2.2", "comment": { "comments": [ { "id": "257063", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Downgrading to Major as the issue is with V8's snapshotting implementation, which we will likely have to revisit.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-10T23:55:14.000+0000", "updated": "2013-06-10T23:55:14.000+0000" }, { "id": "257090", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Ingo: renamed.\n\nHowever, those are output screenshots taken separately, using the same code and following the same steps - i.e. the app has been rebuilt and reinstalled every time (repeating points 1 to 4 as in the description). \n", "updateAuthor": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-11T00:56:52.000+0000", "updated": "2013-06-11T00:56:52.000+0000" }, { "id": "257983", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I think we need to set expectations on what the android profiler should do. V8 will take samples at certain intervals of the program execution to determine where the CPU spent most of this time. The interval for the sampling is around 5ms on Android devices. By taking this approach, it's not accurate to expect every single function call to show up in the profile data. The profiler is meant to track down hotspots of where the CPU spent most of its time, so a better test would be to have a function that takes a long time to run (or have it called many times). Some functions may not take up enough CPU time to show up in the profiler data. Functions with shorter execution times may show up intermittently depending on how long it took during that run and the timing of when v8 takes the samples. \r\n\r\nHere is a blog that describes this behavior: http://blog.nodetime.com/2012/05/cpu-profiling-with-nodetime.html\r\n\r\nI have created an effective test case that should return the a method name every time.\r\n\t\r\n\t{code}\r\n\tvar win = Titanium.UI.createWindow({\r\n\t\ttitle : 'Tab 1',\r\n\t\tbackgroundColor : '#fff'\r\n\t});\r\n\r\n\tvar label1 = Titanium.UI.createLabel({\r\n\t\tcolor : '#999',\r\n\t\ttext : 'I am Window 1',\r\n\t\tfont : {\r\n\t\t\tfontSize : '24dp',\r\n\t\t\tfontFamily : 'Helvetica Neue'\r\n\t\t},\r\n\t\ttextAlign : 'center',\r\n\t\twidth : 'auto'\r\n\t});\r\n\r\n\twin.add(label1);\r\n\r\n\tvar button = Ti.UI.createButton({\r\n\t\tbottom : '10',\r\n\t\ttitle : 'click'\r\n\t});\r\n\r\n\tbutton.addEventListener('click', loopManyTimes);\r\n\tfunction loopManyTimes() {\r\n\t\tfor (var i = 0; i < 10000; i++) {\r\n\t\t\tTi.API.info('-------------' + i);\r\n\t\t}\r\n\t}\r\n\r\n\twin.add(button);\r\n\twin.add(label1);\r\n\r\n\twin.open();\r\n\t\r\n\t{code}\r\n\t\r\n\tRun this sample code and press the button 5 or more times and when you stop the profiler, the loopManyTimes() function should show up.", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-14T20:58:29.000+0000", "updated": "2013-06-14T21:09:21.000+0000" }, { "id": "257987", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Another test case:\n\n1. Launch the KS app \n2. Go to Platform > XHR > File Download\n3. Start the profiler\n4. Click on Large File Download\n5. Wait for it to download 10%\n6. Hit stop profile\n\nExpected result:\nYou should see ondatastream callback as one of the nodes in the profile data\n", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-14T21:04:25.000+0000", "updated": "2013-06-14T21:04:25.000+0000" }, { "id": "258041", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Alloy code:\n\nh6. index.xml\n{code}\n\n \n \n \n \n\n{code}\n\nh6. app.tss\n{code}\n\"Window\": {\n\tbackgroundColor:\"blue\"\n}\n\n\"Button\":{\n\tbottom:10\n}\n\n\"#label1\": {\n\tcolor : 'white',\n text : 'I am Window 1',\n font : {\n fontSize : '24dp',\n fontFamily : 'Helvetica Neue'\n },\n textAlign : 'center',\n width : 'auto'\n} \n{code}\n\nh6. index.js\n{code}\nfunction loopManyTimes() {\n for (var i = 0; i < 10000; i++) {\n Ti.API.info('-------------' + i);\n }\n}\n\n$.index.open();\n{code}", "updateAuthor": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-14T23:32:13.000+0000", "updated": "2013-06-14T23:32:13.000+0000" }, { "id": "258092", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Attached the screenshot of the current results on Android using Allen provided sample code (classic project) and with it's relative Alloy version.\n\nDouble clicking on the 'loopManyTimes' function name in the results, opens correctly the correspective file where the function is declared (app.js for the classic project and index.js for the alloy project) ", "updateAuthor": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-15T21:33:14.000+0000", "updated": "2013-06-15T21:33:14.000+0000" }, { "id": "258199", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Marking as resolved for now since Federico verified the expected behavior.", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-17T17:57:12.000+0000", "updated": "2013-06-17T17:57:12.000+0000" }, { "id": "279532", "author": { "name": "pmishra", "key": "pmishra", "displayName": "Paras Mishra", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Tested with classic app provided by Allen,\r\nloopManyTimes() function shows up everytime after profiler is stopped.\r\n\r\nVerified fix on:\r\nDevice : Google Nexus 3, Android Version: 4.0.4,\r\nSDK: 3.2.0.v20131113183932\r\nCLI version : 3.2.0\r\nOS : MAC OSX 10.8.4\r\nAlloy : 1.3.0\r\nAppcelerator Studio, build: 3.2.0.201311122338\r\nXCode : 5.0.2", "updateAuthor": { "name": "pmishra", "key": "pmishra", "displayName": "Paras Mishra", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2013-11-14T11:20:57.000+0000", "updated": "2013-11-14T11:22:31.000+0000" }, { "id": "279533", "author": { "name": "pmishra", "key": "pmishra", "displayName": "Paras Mishra", "active": true, "timeZone": "Asia/Kolkata" }, "body": "reopened to edit the comment", "updateAuthor": { "name": "pmishra", "key": "pmishra", "displayName": "Paras Mishra", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2013-11-14T11:22:02.000+0000", "updated": "2013-11-14T11:22:02.000+0000" }, { "id": "279534", "author": { "name": "pmishra", "key": "pmishra", "displayName": "Paras Mishra", "active": true, "timeZone": "Asia/Kolkata" }, "body": "closing after editing.", "updateAuthor": { "name": "pmishra", "key": "pmishra", "displayName": "Paras Mishra", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2013-11-14T11:22:51.000+0000", "updated": "2013-11-14T11:22:51.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }