gprof输出为空(gprof output is empty)
在Ubuntu 17.04中使用gprof 2.28和gcc 6.3.0对各种示例程序我得到每个类别的空输出。 如果我在一个示例程序上运行gprof -i,我得到:
1 histogram record 2 call-graph records 0 basic-block count records
我的编译看起来像这样:
cc -g -c sem_test.c -pg cc -o sem_test sem_test.o -lpthread -pg
或这个:
gcc -g3 -O0 -Wall -std=gnu99 -pg -fprofile-arcs -fno-inline -fno-reorder-functions sem_test.c -o sem_test -lpthread -pg
两者都有相同的结果。
我注意到我的gmon.out文件只有687字节,看起来很低。
Using gprof 2.28 and gcc 6.3.0 in Ubuntu 17.04 on a variety of sample programs I get empty output for every category. If I run gprof -i on one example program I get:
1 histogram record 2 call-graph records 0 basic-block count records
My compilation looks something like this:
cc -g -c sem_test.c -pg cc -o sem_test sem_test.o -lpthread -pg
Or this:
gcc -g3 -O0 -Wall -std=gnu99 -pg -fprofile-arcs -fno-inline -fno-reorder-functions sem_test.c -o sem_test -lpthread -pg
Both have the same results.
I notice that my gmon.out file is only 687 bytes which seems low.
原文:https://stackoverflow.com/questions/47482131
更新时间:2024-03-03 17:03
最满意答案
几乎相同,但看起来更容易。
DateTime PreviousDateTime = new DateTime(1970, 1, 1); var stringSecsNow = (DateTime.UtcNow - PreviousDateTime).TotalSeconds.ToString();
Almost same but looks easier.
DateTime PreviousDateTime = new DateTime(1970, 1, 1); var stringSecsNow = (DateTime.UtcNow - PreviousDateTime).TotalSeconds.ToString();
相关问答
更多-
如何获得自1970年以来的日期值的秒数?(how to get the number of seconds passed since 1970 for a date value?)[2022-04-11]
System.currentTimeMillis()为您提供自Unix纪元(1970年1月1日00:00:00 UTC)以来的毫秒数。 将它除以1000以获得秒数。 System.currentTimeMillis() gives you the number of milliseconds since the Unix epoch (January 1, 1970 00:00:00 UTC). Divide it by 1000 to get the number of seconds. -
如何将DateTime转换为自1970年以来的秒数?(How can I convert a DateTime to the number of seconds since 1970?)[2022-10-14]
基本上是这样 这些是我用来转换到Unix时代的方法: public static DateTime ConvertFromUnixTimestamp(double timestamp) { DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); return origin.AddSeconds(timestamp); } public static double ConvertToUnixTimes ... -
将自1970年以来经过的秒数转换为当前日期格式[重复](convert seconds elapsed since 1970 to current date format [duplicate])[2022-08-04]
将秒转换为天/小时/分钟是微不足道的。 将1970年以来的天数转换为当前日期不是。 如果可以,你应该使用库函数,或者你可以使用为朱利安日提供的公式,只要注意朱利安日的 1/1/1970不是0。 PS减法提醒完全没必要: int min = ((now - sec) / 60) % 60; 应该: int min = now / 60 % 60; 甚至更好: int sec = now % 60; now /= 60; int min = now % 60; now /= 60; 等等。 Convert ... -
几乎相同,但看起来更容易。 DateTime PreviousDateTime = new DateTime(1970, 1, 1); var stringSecsNow = (DateTime.UtcNow - PreviousDateTime).TotalSeconds.ToString(); Almost same but looks easier. DateTime PreviousDateTime = new DateTime(1970, 1, 1); var stringSecsNow = ( ...
-
Visual C ++如何将Datetime转换为自1970年以来的秒数(Visual C++ how to convert Datetime to number of seconds since 1970)[2024-01-08]
您可以使用两个日期之间差异的TimeSpan来完成此操作。 像这样的东西: DateTime dtDateYouWantToConvert = /* .... */ DateTime dtReference(1970, 1, 1, 0, 0, 0); TimeSpan tsDiff = dtDateYouWantToConvert - dtReference; // calculate number of seconds (including fractional) since 1/1/1970 dou ... -
你想让UTC_TIMESTAMP做什么来做UNIX_TIMESTAMP呢? 根据定义,Unix时间戳以UTC为单位。 我假设您遇到的问题是,即使您以UTC UNIX_TIMESTAMP存储日期时间, UNIX_TIMESTAMP也会为您提供时区偏移结果,因此您可以获得与您期望的相差几个小时的值。 UNIX_TIMESTAMP尊重MySQL的time_zone变量 ,因此如果所有日期都是UTC,则可以将会话的time_zone变量设置为UTC,这会导致UNIX_TIMESTAMP在将日期时间转换为时间戳时不进 ...
-
假设你的日期是有效的日期。 NSDateFormatter *dateF = [[NSDateFormatter alloc] init]; [dateF setDateStyle:NSDateFormatterFullStyle]; //this format will be according to your own. NSDate *todayDate = [dateF dateFromString: @"5-MAY-2011 00:00:00 +0000"]; //please note, thi ...
-
以下是您可以处理此类场景的各种方法的几个示例 double secondsSince1970 = DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds; // int logic. ints are whole numbers so casting to an int will drop all decimals with no rounding. Console.WriteLine(((long)secondsSince1970) ...
-
python将文件时间转换为1970年之前的日期的日期时间(python convert filetime to datetime for dates before 1970)[2022-05-21]
通过在参考日期添加timedelta ,您可以使用您想要的任何日期公式。 timedelta被允许为正面或负面。 def filetime_to_dt(ft): us = (ft - EPOCH_AS_FILETIME) // 10 return datetime(1970, 1, 1) + timedelta(microseconds = us) By adding a timedelta to a reference date you can use any date formula ... -
从DateTime删除秒数c#(Remove Seconds from DateTime c#)[2023-09-10]
因此,您希望格式化您的值以显示小时和分钟。 你可以这样做: convertSunriseTime = UnixTimeStampToDateTime(currentSunriseTime).ToString("hh\\:mm"); 这里,ToString()方法的参数指定您只对将小时和分钟部分放入结果string感兴趣。 这称为自定义TimeSpan格式字符串 。 还有一组标准的: 标准TimeSpan格式字符串 So you want to format your value to show hours ...