)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"bfcd8fba48fac1deab3036b50ec3192b47e4e1bf","unresolved":true,"context_lines":[{"line_number":10,"context_line":"by using an additional single high 32-bit word that should"},{"line_number":11,"context_line":"be the same for all collected samples."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"High 32-bit word is calculated automatically by the first"},{"line_number":14,"context_line":"coming sample and checked against other samples. Consequent"},{"line_number":15,"context_line":"samples that do not match this high 32-bit word are skipped."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"\u0027with_range\u0027, \u0027start_address\u0027 and \u0027end_address\u0027 are added to"},{"line_number":18,"context_line":"collection function to be able to select samples that"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"791232a4_0b07d91e","line":15,"range":{"start_line":13,"start_character":0,"end_line":15,"end_character":60},"updated":"2024-07-21 19:36:36.000000000","message":"Why not store the full 64 bit samples of the PC?\nOpenOCD runs on a PC, it can use plenty of memory!\nPlus, sampling Linux execution can be interesting to get kernel vs userspace execution by tracking the high part of the address. Limiting to a single high 32 bit value is a too strong limitation.","commit_id":"93aeef8cd18eff8fea4c73f373c97e8ff808f3dd"},{"author":{"_account_id":1002296,"name":"Yurii Shutkin","email":"yurii.shutkin@gmail.com","username":"yshutkin"},"change_message_id":"bf2d2d0d812d9ae1d0edcac67342cd0d9e8e7456","unresolved":false,"context_lines":[{"line_number":10,"context_line":"by using an additional single high 32-bit word that should"},{"line_number":11,"context_line":"be the same for all collected samples."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"High 32-bit word is calculated automatically by the first"},{"line_number":14,"context_line":"coming sample and checked against other samples. Consequent"},{"line_number":15,"context_line":"samples that do not match this high 32-bit word are skipped."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"\u0027with_range\u0027, \u0027start_address\u0027 and \u0027end_address\u0027 are added to"},{"line_number":18,"context_line":"collection function to be able to select samples that"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"82287a5e_d3094931","line":15,"range":{"start_line":13,"start_character":0,"end_line":15,"end_character":60},"in_reply_to":"20da0843_7cf1801b","updated":"2024-07-22 14:39:46.000000000","message":"Done","commit_id":"93aeef8cd18eff8fea4c73f373c97e8ff808f3dd"},{"author":{"_account_id":1002296,"name":"Yurii Shutkin","email":"yurii.shutkin@gmail.com","username":"yshutkin"},"change_message_id":"c6269bd22528dfee52ec4dddc34f73997b805ccf","unresolved":true,"context_lines":[{"line_number":10,"context_line":"by using an additional single high 32-bit word that should"},{"line_number":11,"context_line":"be the same for all collected samples."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"High 32-bit word is calculated automatically by the first"},{"line_number":14,"context_line":"coming sample and checked against other samples. Consequent"},{"line_number":15,"context_line":"samples that do not match this high 32-bit word are skipped."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"\u0027with_range\u0027, \u0027start_address\u0027 and \u0027end_address\u0027 are added to"},{"line_number":18,"context_line":"collection function to be able to select samples that"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"20da0843_7cf1801b","line":15,"range":{"start_line":13,"start_character":0,"end_line":15,"end_character":60},"in_reply_to":"791232a4_0b07d91e","updated":"2024-07-22 13:12:07.000000000","message":"Changing sample array to 64-bit will double memory used for storing samples. 4MB -\u003e 8MB. Even for host memory we should probably care about it.\n\nAlso, a histogram for an address window greater than 2^32 doesn\u0027t seem to be too useful, we either need to have enourmous amount of buckets or bucket size will be too big making profile granularity worse.\n\nNow maximum number of buckets is set to `128*1024*1024` (output file will be up to `256MB`), and for 32-bit window granularity will be 32 addresses in a bucket.","commit_id":"93aeef8cd18eff8fea4c73f373c97e8ff808f3dd"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ef48483656ec7c933562a60d4c1689298c1929a1","unresolved":false,"context_lines":[{"line_number":10,"context_line":"by using an additional single high 32-bit word that should"},{"line_number":11,"context_line":"be the same for all collected samples."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"High 32-bit word is calculated automatically by the first"},{"line_number":14,"context_line":"coming sample and checked against other samples. Consequent"},{"line_number":15,"context_line":"samples that do not match this high 32-bit word are skipped."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"\u0027with_range\u0027, \u0027start_address\u0027 and \u0027end_address\u0027 are added to"},{"line_number":18,"context_line":"collection function to be able to select samples that"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"d2ce7cd0_86c32ea4","line":15,"range":{"start_line":13,"start_character":0,"end_line":15,"end_character":60},"in_reply_to":"82287a5e_d3094931","updated":"2024-08-03 16:48:21.000000000","message":"I think it really depends on what users want/need to profile.\nIf we just want to know the ratio of userspace vs kernel execution, we just need two buckets and discriminate PC lower or higher than 0xffff_0000_0000_0000. Handling 256MB output file is not required. Also, we limit the PC samples at 1M, so we will mostly have zeros in the 128M buckets.\nDoes we really need to change max_buckets from 128K to 128M?","commit_id":"93aeef8cd18eff8fea4c73f373c97e8ff808f3dd"},{"author":{"_account_id":1002273,"name":"Richard Allen","email":"rsaxvc@gmail.com","username":"rsaxvc","status":"@BryghtLabs, @rsaxvc.net"},"change_message_id":"f5f8f72cb6e17e5cba2503b49c59ca22e5e2fb26","unresolved":false,"context_lines":[{"line_number":10,"context_line":"by using an additional single high 32-bit word that should"},{"line_number":11,"context_line":"be the same for all collected samples."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"High 32-bit word is calculated automatically by the first"},{"line_number":14,"context_line":"coming sample and checked against other samples. Consequent"},{"line_number":15,"context_line":"samples that do not match this high 32-bit word are skipped."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"\u0027with_range\u0027, \u0027start_address\u0027 and \u0027end_address\u0027 are added to"},{"line_number":18,"context_line":"collection function to be able to select samples that"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"c7250ebb_7ffd8733","line":15,"range":{"start_line":13,"start_character":0,"end_line":15,"end_character":60},"in_reply_to":"d2ce7cd0_86c32ea4","updated":"2025-02-02 06:34:19.000000000","message":"Sorry to bring up an ancient thread, but I find myself running into the same issues.\n\n\n\u003eOpenOCD runs on a PC, it can use plenty of memory!\n\nAt work I run OpenOCD on a Windows PC. At home I run OpenOCD on a sacrificial Raspberry Pi 0, which can be powered from the a target device. This is why I don\u0027t think we should turn up max_buckets. Also 128M max_buckets isn\u0027t enough either.\n\n\u003e I think it really depends on what users want/need to profile...Does we really need to change max_buckets from 128K to 128M?\n\nSometimes I want a top-level view of where my system spends it cycles. Function-level resolution is fine. But if the top function is something like a blitter or an FFTs, then I need instruction-accurate profiling to see how to improve it. It\u0027s certainly possible to do a coarse, high-level sampling to identify top functions then repeat with min/max addresses per function, but it\u0027s quite tedious.\n\nSome tools support multiple histograms per gmon file. Do we know what users use our gmon files with? Mostly gprof(https://binutils.sourceware.narkive.com/QUKLfKNL/gprof-disjoint-histograms)?\n\nI\u0027ve got a patchset that generates gmon files without buffering the entire histogram. This could be extended to detect long strings of zero-bins, and if there\u0027s enough zero-bins, we could create another histogram.","commit_id":"93aeef8cd18eff8fea4c73f373c97e8ff808f3dd"}],"/PATCHSET_LEVEL":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"bfcd8fba48fac1deab3036b50ec3192b47e4e1bf","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"2616bf47_2e1d7498","updated":"2024-07-21 19:36:36.000000000","message":"Thanks for the patch.\nThe code in OpenOCD has been partially converted from 32 to 64 bits. The target profiling is one of the functionality not converted yet. A patch for that is welcome.\n\nFew considerations:\n- Please use the data type `target_addr_t` for the 64 bits sampled PC. It is defined as:\n`src/helper/types.h: typedef uint64_t target_addr_t;`\n\n- Each `target-\u003etype-\u003eprofiling` should only return the data as fast as possible. The filtering to check if values are in the range `start_address` - `end_address` should remain in `handle_profile_command` and not replicated in every implementation.\n\n- Don\u0027t allow only one value of high PC 32 bits. Sample the whole 64 bit as user could require a range across two or more values of high PC.\n\n- in the new function `write_vma()` you check the PC size... I don\u0027t have a better way to get it, so it\u0027s probably ok. Not now, but maybe in a future patch it could be useful to force a PC size with a flag on the `profile` command. Some 64 bit CPU (e.g. Cortex-A35) can run 32 code and could be important to export the profile in 32 bits.","commit_id":"93aeef8cd18eff8fea4c73f373c97e8ff808f3dd"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"1022bebc1ee925d6c19dc3296a02122957b65401","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":4,"id":"2deb2be9_b64294c9","updated":"2024-08-03 17:09:45.000000000","message":"see also https://review.openocd.org/c/openocd/+/8277","commit_id":"a96152b01c0dd83b89d4121bc53f9c138738f411"},{"author":{"_account_id":1002296,"name":"Yurii Shutkin","email":"yurii.shutkin@gmail.com","username":"yshutkin"},"change_message_id":"d3bd59f929458b135d843f42af521de03f23fcee","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":8,"id":"875cea06_925cf803","updated":"2025-01-21 20:20:58.000000000","message":"Hi there! I\u0027ve updated the patch after merging CL 8431, espressif is handled the same way as cortex_m.\nIf you are still ok with this approach, please review the CL again.","commit_id":"0b95fa1ab3f87aa500254cb6c6d9d55c1fc8687b"},{"author":{"_account_id":1002296,"name":"Yurii Shutkin","email":"yurii.shutkin@gmail.com","username":"yshutkin"},"change_message_id":"bf9262e16026cfc4cfb8fd148f9a86c8d3218b97","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":12,"id":"294db6ae_c6d391ce","updated":"2025-04-06 13:03:01.000000000","message":"removed cast to double by fixing regular bucket size","commit_id":"85c8affe6193ec46f3c7a78b1ba28feb10cee52e"}],"src/target/cortex_m.c":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ef48483656ec7c933562a60d4c1689298c1929a1","unresolved":true,"context_lines":[{"line_number":2321,"context_line":""},{"line_number":2322,"context_line":"\t\t\tretval \u003d mem_ap_read_buf_noincr(armv7m-\u003edebug_ap,"},{"line_number":2323,"context_line":"\t\t\t\t\t\t(void *)\u0026samples[sample_count],"},{"line_number":2324,"context_line":"\t\t\t\t\t\t8, read_count, DWT_PCSR);"},{"line_number":2325,"context_line":"\t\t\tsample_count +\u003d read_count;"},{"line_number":2326,"context_line":"\t\t} else {"},{"line_number":2327,"context_line":"\t\t\ttarget_read_u64(target, DWT_PCSR, \u0026samples[sample_count++]);"}],"source_content_type":"text/x-csrc","patch_set":4,"id":"a6697c3c_bd26cf9b","line":2324,"updated":"2024-08-03 16:48:21.000000000","message":"Humm, unfortunately this will not work!\nThe new code now requires multiple 64bit reads from a 32bit register!\nI\u0027m not sure it will not produce the desired result, and it will double the data transfer between OpenOCD and the target.\nYou need to use an intermediate buffer for the 32 bit samples, then move it to the 64 bit buffer. It can be the same buffer, so you can, at the beginning of this function:\n`uint32_t *samples_32t \u003d (uint32_t *)samples;`\nthen use this 32 bit buffer across the function and at the end\n```\n*num_samples \u003d sample_count;\n/* output buffer has 64 bits/sample */\nwhile (sample_count--)\n\tsamples[sample_count] \u003d samples_32t[sample_count];\nreturn retval\n```","commit_id":"a96152b01c0dd83b89d4121bc53f9c138738f411"},{"author":{"_account_id":1002296,"name":"Yurii Shutkin","email":"yurii.shutkin@gmail.com","username":"yshutkin"},"change_message_id":"9686a0dcc57749a1a23df879a2a4818b69e86f72","unresolved":false,"context_lines":[{"line_number":2321,"context_line":""},{"line_number":2322,"context_line":"\t\t\tretval \u003d mem_ap_read_buf_noincr(armv7m-\u003edebug_ap,"},{"line_number":2323,"context_line":"\t\t\t\t\t\t(void *)\u0026samples[sample_count],"},{"line_number":2324,"context_line":"\t\t\t\t\t\t8, read_count, DWT_PCSR);"},{"line_number":2325,"context_line":"\t\t\tsample_count +\u003d read_count;"},{"line_number":2326,"context_line":"\t\t} else {"},{"line_number":2327,"context_line":"\t\t\ttarget_read_u64(target, DWT_PCSR, \u0026samples[sample_count++]);"}],"source_content_type":"text/x-csrc","patch_set":4,"id":"31a81b5b_d12132f7","line":2324,"in_reply_to":"04ed3e6d_0a07724f","updated":"2024-08-11 15:32:22.000000000","message":"Ack","commit_id":"a96152b01c0dd83b89d4121bc53f9c138738f411"},{"author":{"_account_id":1002296,"name":"Yurii Shutkin","email":"yurii.shutkin@gmail.com","username":"yshutkin"},"change_message_id":"d035fe7861be7c65a6e0529c28f2e3ae634f7f0b","unresolved":true,"context_lines":[{"line_number":2321,"context_line":""},{"line_number":2322,"context_line":"\t\t\tretval \u003d mem_ap_read_buf_noincr(armv7m-\u003edebug_ap,"},{"line_number":2323,"context_line":"\t\t\t\t\t\t(void *)\u0026samples[sample_count],"},{"line_number":2324,"context_line":"\t\t\t\t\t\t8, read_count, DWT_PCSR);"},{"line_number":2325,"context_line":"\t\t\tsample_count +\u003d read_count;"},{"line_number":2326,"context_line":"\t\t} else {"},{"line_number":2327,"context_line":"\t\t\ttarget_read_u64(target, DWT_PCSR, \u0026samples[sample_count++]);"}],"source_content_type":"text/x-csrc","patch_set":4,"id":"04ed3e6d_0a07724f","line":2324,"in_reply_to":"2c064e7a_4641bc6a","updated":"2024-08-05 11:59:06.000000000","message":"To avoid second allocation I\u0027ve used the same buffer but casted it to uint32_t*. In write_gmon function I passed a flag that indicates that samples are stored as 32-bit words. Do you think this solution is ok?","commit_id":"a96152b01c0dd83b89d4121bc53f9c138738f411"},{"author":{"_account_id":1002296,"name":"Yurii Shutkin","email":"yurii.shutkin@gmail.com","username":"yshutkin"},"change_message_id":"0a218ecb7c8e6885d5c2033accd3b74dff0e1ddb","unresolved":true,"context_lines":[{"line_number":2321,"context_line":""},{"line_number":2322,"context_line":"\t\t\tretval \u003d mem_ap_read_buf_noincr(armv7m-\u003edebug_ap,"},{"line_number":2323,"context_line":"\t\t\t\t\t\t(void *)\u0026samples[sample_count],"},{"line_number":2324,"context_line":"\t\t\t\t\t\t8, read_count, DWT_PCSR);"},{"line_number":2325,"context_line":"\t\t\tsample_count +\u003d read_count;"},{"line_number":2326,"context_line":"\t\t} else {"},{"line_number":2327,"context_line":"\t\t\ttarget_read_u64(target, DWT_PCSR, \u0026samples[sample_count++]);"}],"source_content_type":"text/x-csrc","patch_set":4,"id":"2c064e7a_4641bc6a","line":2324,"in_reply_to":"a6697c3c_bd26cf9b","updated":"2024-08-04 11:48:16.000000000","message":"Then we need a flag that says that output `samples` array contains packed 32-bit words.","commit_id":"a96152b01c0dd83b89d4121bc53f9c138738f411"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ef48483656ec7c933562a60d4c1689298c1929a1","unresolved":true,"context_lines":[{"line_number":2324,"context_line":"\t\t\t\t\t\t8, read_count, DWT_PCSR);"},{"line_number":2325,"context_line":"\t\t\tsample_count +\u003d read_count;"},{"line_number":2326,"context_line":"\t\t} else {"},{"line_number":2327,"context_line":"\t\t\ttarget_read_u64(target, DWT_PCSR, \u0026samples[sample_count++]);"},{"line_number":2328,"context_line":"\t\t}"},{"line_number":2329,"context_line":""},{"line_number":2330,"context_line":"\t\tif (retval !\u003d ERROR_OK) {"}],"source_content_type":"text/x-csrc","patch_set":4,"id":"27ac00f0_3a55069c","line":2327,"updated":"2024-08-03 16:48:21.000000000","message":"as above!","commit_id":"a96152b01c0dd83b89d4121bc53f9c138738f411"},{"author":{"_account_id":1002296,"name":"Yurii Shutkin","email":"yurii.shutkin@gmail.com","username":"yshutkin"},"change_message_id":"d035fe7861be7c65a6e0529c28f2e3ae634f7f0b","unresolved":false,"context_lines":[{"line_number":2324,"context_line":"\t\t\t\t\t\t8, read_count, DWT_PCSR);"},{"line_number":2325,"context_line":"\t\t\tsample_count +\u003d read_count;"},{"line_number":2326,"context_line":"\t\t} else {"},{"line_number":2327,"context_line":"\t\t\ttarget_read_u64(target, DWT_PCSR, \u0026samples[sample_count++]);"},{"line_number":2328,"context_line":"\t\t}"},{"line_number":2329,"context_line":""},{"line_number":2330,"context_line":"\t\tif (retval !\u003d ERROR_OK) {"}],"source_content_type":"text/x-csrc","patch_set":4,"id":"c6ce7891_f0f80f49","line":2327,"in_reply_to":"27ac00f0_3a55069c","updated":"2024-08-05 11:59:06.000000000","message":"Ack","commit_id":"a96152b01c0dd83b89d4121bc53f9c138738f411"}],"src/target/target.c":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ef48483656ec7c933562a60d4c1689298c1929a1","unresolved":true,"context_lines":[{"line_number":4276,"context_line":""},{"line_number":4277,"context_line":"\t/* FIXME: What is the reasonable number of buckets?"},{"line_number":4278,"context_line":"\t * The profiling result will be more accurate if there are enough buckets. */"},{"line_number":4279,"context_line":"\tstatic const uint32_t max_buckets \u003d 128 * 1024 * 1024; /* maximum buckets. */"},{"line_number":4280,"context_line":"\tuint64_t num_buckets \u003d address_space / sizeof(UNIT);"},{"line_number":4281,"context_line":"\tif (num_buckets \u003e (uint64_t)max_buckets)"},{"line_number":4282,"context_line":"\t\tnum_buckets \u003d max_buckets;"}],"source_content_type":"text/x-csrc","patch_set":4,"id":"aa01b7d4_c2fdd7e9","line":4279,"updated":"2024-08-03 16:48:21.000000000","message":"use `uint64_t` so we avoid cast below.\n\nAs already said, I\u0027m not sure we want to increase this by 1024; the output file get much bigger and the histogram full of zeros because we only take `MAX_PROFILE_SAMPLE_NUM \u003d 1000000` samples.","commit_id":"a96152b01c0dd83b89d4121bc53f9c138738f411"},{"author":{"_account_id":1002296,"name":"Yurii Shutkin","email":"yurii.shutkin@gmail.com","username":"yshutkin"},"change_message_id":"d035fe7861be7c65a6e0529c28f2e3ae634f7f0b","unresolved":false,"context_lines":[{"line_number":4276,"context_line":""},{"line_number":4277,"context_line":"\t/* FIXME: What is the reasonable number of buckets?"},{"line_number":4278,"context_line":"\t * The profiling result will be more accurate if there are enough buckets. */"},{"line_number":4279,"context_line":"\tstatic const uint32_t max_buckets \u003d 128 * 1024 * 1024; /* maximum buckets. */"},{"line_number":4280,"context_line":"\tuint64_t num_buckets \u003d address_space / sizeof(UNIT);"},{"line_number":4281,"context_line":"\tif (num_buckets \u003e (uint64_t)max_buckets)"},{"line_number":4282,"context_line":"\t\tnum_buckets \u003d max_buckets;"}],"source_content_type":"text/x-csrc","patch_set":4,"id":"c9baae67_ac5b74ba","line":4279,"in_reply_to":"aa01b7d4_c2fdd7e9","updated":"2024-08-05 11:59:06.000000000","message":"Ack.\nchanged to 1024x1024 as of https://review.openocd.org/c/openocd/+/8277","commit_id":"a96152b01c0dd83b89d4121bc53f9c138738f411"},{"author":{"_account_id":1002273,"name":"Richard Allen","email":"rsaxvc@gmail.com","username":"rsaxvc","status":"@BryghtLabs, @rsaxvc.net"},"change_message_id":"bfe02c04eb86b86200fec1e12f8f505ab1bc2939","unresolved":true,"context_lines":[{"line_number":4302,"context_line":"\t\tint64_t b \u003d num_buckets;"},{"line_number":4303,"context_line":"\t\tint64_t c \u003d address_space;"},{"line_number":4304,"context_line":"\t\t// cast to double to avoid integer overflow"},{"line_number":4305,"context_line":"\t\tuint32_t index_t \u003d (uint32_t)(((double)a * b) / c);"},{"line_number":4306,"context_line":"\t\tbuckets[index_t]++;"},{"line_number":4307,"context_line":"\t}"},{"line_number":4308,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":9,"id":"b8554baa_a21ec331","line":4305,"updated":"2025-02-02 05:58:47.000000000","message":"Do we need to `fesetround(FE_TOWARDZERO)`?","commit_id":"72026b422d93a1fc64ae9e3055c7562e81a1a43f"},{"author":{"_account_id":1002296,"name":"Yurii Shutkin","email":"yurii.shutkin@gmail.com","username":"yshutkin"},"change_message_id":"bf9262e16026cfc4cfb8fd148f9a86c8d3218b97","unresolved":false,"context_lines":[{"line_number":4302,"context_line":"\t\tint64_t b \u003d num_buckets;"},{"line_number":4303,"context_line":"\t\tint64_t c \u003d address_space;"},{"line_number":4304,"context_line":"\t\t// cast to double to avoid integer overflow"},{"line_number":4305,"context_line":"\t\tuint32_t index_t \u003d (uint32_t)(((double)a * b) / c);"},{"line_number":4306,"context_line":"\t\tbuckets[index_t]++;"},{"line_number":4307,"context_line":"\t}"},{"line_number":4308,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":9,"id":"5c48b81f_813158e4","line":4305,"in_reply_to":"770eae36_50107191","updated":"2025-04-06 13:03:01.000000000","message":"Done","commit_id":"72026b422d93a1fc64ae9e3055c7562e81a1a43f"},{"author":{"_account_id":1002296,"name":"Yurii Shutkin","email":"yurii.shutkin@gmail.com","username":"yshutkin"},"change_message_id":"fe2e7eb13968e8c768d2a4246d225779937d3cee","unresolved":true,"context_lines":[{"line_number":4302,"context_line":"\t\tint64_t b \u003d num_buckets;"},{"line_number":4303,"context_line":"\t\tint64_t c \u003d address_space;"},{"line_number":4304,"context_line":"\t\t// cast to double to avoid integer overflow"},{"line_number":4305,"context_line":"\t\tuint32_t index_t \u003d (uint32_t)(((double)a * b) / c);"},{"line_number":4306,"context_line":"\t\tbuckets[index_t]++;"},{"line_number":4307,"context_line":"\t}"},{"line_number":4308,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":9,"id":"f9b0cf61_39f84ebf","line":4305,"in_reply_to":"b8554baa_a21ec331","updated":"2025-02-03 07:19:54.000000000","message":"Looks like FE_TOWARDZERO is for FP rounding, but here double is just casted to integer that always acts as round downward, isn\u0027t it?","commit_id":"72026b422d93a1fc64ae9e3055c7562e81a1a43f"},{"author":{"_account_id":1002273,"name":"Richard Allen","email":"rsaxvc@gmail.com","username":"rsaxvc","status":"@BryghtLabs, @rsaxvc.net"},"change_message_id":"da7e39635d20718f2140602317c7ea19e5ded5fa","unresolved":true,"context_lines":[{"line_number":4302,"context_line":"\t\tint64_t b \u003d num_buckets;"},{"line_number":4303,"context_line":"\t\tint64_t c \u003d address_space;"},{"line_number":4304,"context_line":"\t\t// cast to double to avoid integer overflow"},{"line_number":4305,"context_line":"\t\tuint32_t index_t \u003d (uint32_t)(((double)a * b) / c);"},{"line_number":4306,"context_line":"\t\tbuckets[index_t]++;"},{"line_number":4307,"context_line":"\t}"},{"line_number":4308,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":9,"id":"770eae36_50107191","line":4305,"in_reply_to":"f9b0cf61_39f84ebf","updated":"2025-02-04 02:09:01.000000000","message":"I mean (double)a rounds if a is so large it cannot be represented exactly by a double. I\u0027m not familiar this aspect of 64-bit systems, maybe it\u0027s not a problem. Or would only be a problem of samples that fall near the edge of buckets.","commit_id":"72026b422d93a1fc64ae9e3055c7562e81a1a43f"}],"src/target/target_type.h":[{"author":{"_account_id":1002273,"name":"Richard Allen","email":"rsaxvc@gmail.com","username":"rsaxvc","status":"@BryghtLabs, @rsaxvc.net"},"change_message_id":"bfe02c04eb86b86200fec1e12f8f505ab1bc2939","unresolved":true,"context_lines":[{"line_number":296,"context_line":"\tint (*gdb_query_custom)(struct target *target, const char *packet, char **response_p);"},{"line_number":297,"context_line":""},{"line_number":298,"context_line":"\t/* do target profiling."},{"line_number":299,"context_line":"     * On 64-bits systems, samples are stored as 64-bit addresses."},{"line_number":300,"context_line":"     * On 32-bits systems, samples array is first casted to uint32_t* and addresses"},{"line_number":301,"context_line":"     * are stored as 32-bit words. base32 is set to true in this case."},{"line_number":302,"context_line":"\t */"}],"source_content_type":"text/x-csrc","patch_set":9,"id":"392a0a37_e8c948f4","line":299,"updated":"2025-02-02 05:58:47.000000000","message":"nit: I think this should be 1x tab, then 1x space before the *","commit_id":"72026b422d93a1fc64ae9e3055c7562e81a1a43f"},{"author":{"_account_id":1002296,"name":"Yurii Shutkin","email":"yurii.shutkin@gmail.com","username":"yshutkin"},"change_message_id":"fe2e7eb13968e8c768d2a4246d225779937d3cee","unresolved":false,"context_lines":[{"line_number":296,"context_line":"\tint (*gdb_query_custom)(struct target *target, const char *packet, char **response_p);"},{"line_number":297,"context_line":""},{"line_number":298,"context_line":"\t/* do target profiling."},{"line_number":299,"context_line":"     * On 64-bits systems, samples are stored as 64-bit addresses."},{"line_number":300,"context_line":"     * On 32-bits systems, samples array is first casted to uint32_t* and addresses"},{"line_number":301,"context_line":"     * are stored as 32-bit words. base32 is set to true in this case."},{"line_number":302,"context_line":"\t */"}],"source_content_type":"text/x-csrc","patch_set":9,"id":"3f0bce71_22cb5a82","line":299,"in_reply_to":"392a0a37_e8c948f4","updated":"2025-02-03 07:19:54.000000000","message":"Done","commit_id":"72026b422d93a1fc64ae9e3055c7562e81a1a43f"}]}
