[Developers] CactusUtils/2079: Patch for thorn TimerReport: Output timer reports to a file instead of to stdout

schnetter at cct.lsu.edu schnetter at cct.lsu.edu
Tue Jan 16 08:43:59 CST 2007


>Number:         2079
>Notify-List:    developers at cactuscode.org
>Category:       CactusUtils
>Synopsis:       Patch for thorn TimerReport: Output timer reports to a file instead of to stdout
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    goodale
>State:          open
>Class:          feature-request
>Submitter-Id:   user
>Arrival-Date:   Tue Jan 16 08:43:59 -0600 2007
>Originator:     Erik Schnetter
>Release:        Cactus 4.0.b16
>Organization:
>Environment:
>Description:
Add a parameter to thorn CactusUtils/TimerReport to output the timer reports to files instead of to stdout.  The reports are often many lines long, and they use more than 80 characters per line, cluttering stdout.  Additionally, having them in files allows looking at timer reports from all processors without collecting all processors' stdout.

The implementation is a bit unelegant, since the flesh function CCTK_SchedulePrintTimes does not accest a FILE* argument.  Instead, TimerReport redirects all stdout to file before outputting the report, and unredirects afterwards.  This requires the system calls open, dup, and close, which are not part of the C standard (but are already autodetected when configuring Cactus).
>How-To-Repeat:
>Fix:
Unknown
>Unformatted:
 ----gnatsweb-attachment----
 Content-Type: application/octet-stream; name="TimerReport-outfile.diff"
 Content-Transfer-Encoding: base64
 Content-Disposition: attachment; filename="TimerReport-outfile.diff"
 
 SW5kZXg6IGludGVyZmFjZS5jY2wKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpSQ1MgZmlsZTogL2NhY3R1c2RldmN2cy9D
 YWN0dXNVdGlscy9UaW1lclJlcG9ydC9pbnRlcmZhY2UuY2NsLHYKcmV0cmlldmluZyByZXZpc2lv
 biAxLjMKZGlmZiAtdSAtcjEuMyBpbnRlcmZhY2UuY2NsCi0tLSBpbnRlcmZhY2UuY2NsCTE2IE1h
 eSAyMDA0IDE0OjQ4OjI4IC0wMDAwCTEuMworKysgaW50ZXJmYWNlLmNjbAkxNiBKYW4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AxLjcgMjAwNS8wNS8wOCAxMjox
 NzoyMSBzY2huZXR0ZXIgRXhwICQiOwpAQCAtMjgsNiArMzYsOCBAQAogICoqKioqKioqKioqKioq
 KioqKioqKiBMb2NhbCBSb3V0aW5lIFByb3RvdHlwZXMgKioqKioqKioqKioqKioqKioqKioqCiAg
 KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
 KioqKioqKioqKiovCiAKK3N0YXRpYyB2b2lkIFByaW50VGltZXMgKENDVEtfQVJHVU1FTlRTKTsK
 KwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
 KioqKioqKioqKioqKioqCiAgKioqKioqKioqKioqKioqKioqKioqICBTY2hlZHVsZWQgUm91dGlu
 ZSBQcm90b3R5cGVzICAqKioqKioqKioqKioqKioKICAqKioqKioqKioqKioqKioqKioqKioqKioq
 KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTY4LDcgKzc4
 LDcgQEAKICAgICBDQ1RLX1ZJbmZvKENDVEtfVEhPUk5TVFJJTkcsCiAgICAgICAgICAgICAgICAi
 VGltZXIgUmVwb3J0IGF0IGl0ZXJhdGlvbiAlZCB0aW1lICVnIiwKICAgICAgICAgICAgICAgIGNj
 dGtfaXRlcmF0aW9uLCAoZG91YmxlKWNjdGtfdGltZSk7Ci0gICAgQ0NUS19TY2hlZHVsZVByaW50
 VGltZXMoTlVMTCk7CisgICAgUHJpbnRUaW1lcyhDQ1RLX1BBU1NfQ1RPQyk7CiAKICAgICBpZiAo
 bmV4dCkKICAgICB7CkBAIC05OCw3ICsxMDgsNyBAQAogICAgIENDVEtfVkluZm8oQ0NUS19USE9S
 TlNUUklORywKICAgICAgICAgICAgICAgICJUaW1lciBSZXBvcnQgYmVmb3JlIGNoZWNrcG9pbnRp
 bmcgYXQgaXRlcmF0aW9uICVkLCB0aW1lICVnIiwKICAgICAgICAgICAgICAgIGNjdGtfaXRlcmF0
 aW9uLCAoZG91YmxlKWNjdGtfdGltZSk7Ci0gICAgQ0NUS19TY2hlZHVsZVByaW50VGltZXMoTlVM
 TCk7CisgICAgUHJpbnRUaW1lcyhDQ1RLX1BBU1NfQ1RPQyk7CiAgICAgCiAgIH0KIH0KQEAgLTEw
 NywzICsxMTcsNzcgQEAKICAqKioqKioqKioqKioqKioqKioqKiAgICBJbnRlcm5hbCBSb3V0aW5l
 cyAgICoqKioqKioqKioqKioqKioqKioqKioqKgogICoqKioqKioqKioqKioqKioqKioqKioqKioq
 KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCitzdGF0aWMgdm9p
 ZCBQcmludFRpbWVzIChDQ1RLX0FSR1VNRU5UUykKK3sKKyAgREVDTEFSRV9DQ1RLX0FSR1VNRU5U
 UzsKKyAgREVDTEFSRV9DQ1RLX1BBUkFNRVRFUlM7CisgIAorICBpbnQgbXlwcm9jOworICBjaGFy
 IGZpbGVuYW1lIFsxMDAwMF07CisgIAorICBzdGF0aWMgaW50IGZpcnN0X3RpbWUgPSAxOworICBp
 bnQgZmxhZ3M7CisgIGludCBjb25zdCBtb2RlID0gMDY0NDsgICAgICAgIC8qIHJ3LXItLXItLSwg
 b3IgYStyIHUrdyAqLworICAKKyAgaW50IGZkc2F2ZSwgZmRmaWxlOworICAKKyAgCisgIGlmIChD
 Q1RLX0VRVUFMUyAob3V0X2ZpbGVuYW1lLCAiIikpCisgIHsKKyAgICAvKiBQcmludCB0byBzdGRv
 dXQuICAqLworICAgIENDVEtfU2NoZWR1bGVQcmludFRpbWVzKE5VTEwpOworICB9CisgIGVsc2UK
 KyAgeworICAgIC8qIFByaW50IHRvIGEgZmlsZS4gICovCisjaWZuZGVmIEhBVkVfVU5JU1REX0gK
 KyAgICBDQ1RLX1dBUk4gKDEsICJDYW5ub3QgcmVkaXJlY3QgdGltZXIgcmVwb3J0IG91dHB1dCB0
 byBhIGZpbGU7IHRoZSBv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maWxlbmFtZSk7CisgICAgICBnb3RvIGNs
 ZWFudXA7CisgICAgfQorICAgIGNsb3NlICgxKTsKKyAgICBkdXAgKGZkZmlsZSk7ICAgICAgICAg
 ICAgICAgLyogZHVwIHRvIDEsIGkuZS4sIHN0ZG91dCBhZ2FpbiAqLworICAgIGNsb3NlIChmZGZp
 bGUpOworICAgIAorICAgIC8qIFByaW50IHRoZSBzY2hlZHVsZSB0byB0aGUgZmlsZSAqLworICAg
 IHByaW50ZiAoIlRpbWVyIFJlcG9ydCBhdCBpdGVyYXRpb24gJWQgdGltZSAlZzpcblxuIiwKKyAg
 ICAgICAgICAgIGNjdGtfaXRlcmF0aW9uLCAoZG91YmxlKSBjY3RrX3RpbWUpOworICAgIENDVEtf
 U2NoZWR1bGVQcmludFRpbWVzKE5VTEwpOworICAgIHByaW50ZiAoIlxuKioqKioqKioqKioqKioq
 KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
 KioqKioqKipcbiIpOworICAgIAorICAgIC8qIFJlZGlyZWN0IHN0ZG91dCBiYWNrICovCisgICAg
 ZmZsdXNoIChzdGRvdXQpOworICAgIGNsb3NlICgxKTsKKyAgICBkdXAgKGZkc2F2ZSk7CisgIGNs
 ZWFudXA6CisgICAgY2xvc2UgKGZkc2F2ZSk7CisgICAgCisjZW5kaWYgIC8qICNpZmRlZiBIQVZF
 X1VOSVNURF9IICovCisgICAgCisgIH0KK30K
 


More information about the Developers mailing list