当前位置:首页>java>嵌入式 Linux 必知:几个超实用代码小片段

嵌入式 Linux 必知:几个超实用代码小片段

  • 2026-02-01 00:23:28
嵌入式 Linux 必知:几个超实用代码小片段

星标公众号,让嵌入式知识 “投喂” 不停歇!

大家好,我是杂烩君。

这篇整理几个在嵌入式Linux项目里高频用到的 C 语言小片段。它们都属于“排障/打点/设备信息”的基础能力:能快速把关键上下文打进日志,定位问题会省很多时间。

先放一个通用思路:无论从 sysfs 读文件,还是用 ioctl 拿网卡信息,核心都是“选数据源 → 读取 → 解析 → 格式化输出”。

1. 获取内存信息

内存信息经常用来做“是否内存紧张”的快速判断:比如日志里每隔一段时间打点一次 MemAvailable,很多内存泄漏/缓存膨胀的问题会更容易抓到趋势。

代码:

#include<stdio.h>#include<string.h>#define PROC_MEMINFO "/proc/meminfo"intget_meminfo_kb(long *total_kb, long *avail_kb){    FILE *fp = fopen(PROC_MEMINFO, "r");if (NULL == fp)    {printf("fopen error\n");return-1;    }char line[256] = {0};long total = -1;long avail = -1;while (NULL != fgets(line, sizeof(line), fp))    {if (0 == strncmp(line, "MemTotal:"9))        {sscanf(line, "MemTotal: %ld kB", &total);        }elseif (0 == strncmp(line, "MemAvailable:"13))        {sscanf(line, "MemAvailable: %ld kB", &avail);        }if (total >= 0 && avail >= 0)        {break;        }    }    fclose(fp);if (total < 0 || avail < 0)    {printf("parse error\n");return-1;    }    *total_kb = total;    *avail_kb = avail;return0;}intmain(void){long total_kb = 0;long avail_kb = 0;    get_meminfo_kb(&total_kb, &avail_kb);printf("mem_total = %ld kB, mem_available = %ld kB\n", total_kb, avail_kb);return0;}

注意点:

  • 不同内核字段可能略有差异,但 MemTotal/MemAvailable 在多数发行版都能拿到。

2. 获取CPU温度

应用可以定时获取 CPU 温度,比如性能异常频繁重启降频等场景,温度往往是第一批要确认的指标。

代码:

#include<stdio.h>   #include<unistd.h>#include<stdlib.h>#include<string.h>#include<errno.h>#define CPU_TEMP_FILE0  "/sys/devices/virtual/thermal/thermal_zone0/temp"structcpu_temperature{int integer_part;int decimal_part;};typedefstructcpu_temperaturecpu_temperature_t;cpu_temperature_tget_cpu_temperature(constchar *_cpu_temp_file){    FILE *fp = NULL;cpu_temperature_t cpu_temperature = {0};int temp = 0;    fp = fopen(_cpu_temp_file, "r");if (NULL == fp)    {printf("fopen file error\n");return cpu_temperature;    }fscanf(fp, "%d", &temp);    cpu_temperature.integer_part = temp / 1000;    cpu_temperature.decimal_part = temp % 1000 / 100;    fclose(fp);return cpu_temperature;}intmain(int arc, char *argv[]){cpu_temperature_t cpu_temperature = {0};    cpu_temperature = get_cpu_temperature(CPU_TEMP_FILE0);printf("cpu_temperature = %d.%d ℃\n", cpu_temperature.integer_part, cpu_temperature.decimal_part);return0;}

运行结果:

注意点:

  • 路径不固定:不同平台 thermal_zoneX 可能不同,建议把路径做成可配置(本文保持写死路径,便于演示)。
  • 单位:多数 sysfs 温度是“毫摄氏度”,常见为 42000 表示 42.0℃。
  • 采样频率:日志里打点别太密(例如 1s~10s 一次),避免 I/O 噪声影响定位。

3. 获取文件大小

有时候需要先知道文件大小:例如发送文件、预分配缓冲区、做进度条等。

代码:

#include<sys/stat.h>  #include<unistd.h>  #include<stdio.h>  longget_file_size(constchar *_file_name){    FILE * fp = fopen(_file_name, "r");if (NULL == fp)    {printf("fopen error\n");return-1;    }    fseek(fp, 0L, SEEK_END);long size = ftell(fp);    fclose(fp);return size;}intmain(){#define FILE_NAME  "./get_file_size"long file_size = get_file_size(FILE_NAME);printf("file_size = %ld\n", file_size);return0;}

运行结果:

注意点:

  • 这个例子用了 fseek/ftell,对“普通文件”足够直观;更严谨的方式是 stat()(本节不展开)。
  • 如果你读的是二进制文件,Windows 上建议用 "rb";Linux 上 "r" 通常也能工作。

4. 获取时间戳

时间戳最常见用途是给日志打点:把多线程/多进程事件串起来,排障效率会明显提升。

代码:

#include<stdio.h>   #include<unistd.h>#include<stdlib.h>#include<string.h>#include<errno.h>#include<sys/time.h>#include<time.h>longlongget_sys_time_ms(void){longlong time_ms = 0;structtimevalsys_current_time;    gettimeofday(&sys_current_time, NULL);    time_ms = ((longlong)sys_current_time.tv_sec*1000000 + sys_current_time.tv_usec) / 1000;return time_ms;}intmain(int arc, char *argv[]){longlong cur_sys_time = get_sys_time_ms();printf("cur_sys_time = %lld ms\n", cur_sys_time);return0;}

运行结果:

注意点:

  • gettimeofday() 取的是“墙上时间”(可能被 NTP/手动改时间影响)。如果你要测耗时/间隔,更推荐 clock_gettime(CLOCK_MONOTONIC, ...)
  • 统一单位很重要:本文返回毫秒,日志可直接对齐排序。

5. 获取MAC

MAC 地址经常被用作设备唯一标识(或参与生成设备 ID)。这里用 ioctl(SIOCGIFHWADDR) 从指定网卡获取。

代码:

#include<stdio.h>#include<stdint.h>#include<net/if.h>#include<sys/socket.h>#include<sys/ioctl.h>#include<arpa/inet.h>#include<unistd.h>#include<string.h>intget_netif_mac(constchar *_ifr_name, char *_mac){int32_t             ret = -1;structifreqm_ifreq;int32_t             sock = 0;    sock = socket(AF_INET, SOCK_STREAM, 0);if (sock < 0)    {printf("socket err\r\n");goto err;    }strncpy(m_ifreq.ifr_name, _ifr_name, IFNAMSIZ);    m_ifreq.ifr_name[IFNAMSIZ - 1] = 0;    ret = ioctl(sock,SIOCGIFHWADDR, &m_ifreq);if (ret < 0)    {printf("ioctl err:%d\r\n",ret);goto err;    }snprintf((char *)_mac, 32"%02x%02x%02x%02x%02x%02x", (uint8_t)m_ifreq.ifr_hwaddr.sa_data[0],                                                     (uint8_t)m_ifreq.ifr_hwaddr.sa_data[1],                                                     (uint8_t)m_ifreq.ifr_hwaddr.sa_data[2],                                                     (uint8_t)m_ifreq.ifr_hwaddr.sa_data[3],                                                     (uint8_t)m_ifreq.ifr_hwaddr.sa_data[4],                                                     (uint8_t)m_ifreq.ifr_hwaddr.sa_data[5]);return0;err:return-1;}intmain(int argc, char **argv){char mac_str[32] = {0};    get_netif_mac("wlan1", mac_str);printf("mac = %s\n", mac_str);return0;}

运行结果:

注意点:

  • 网卡名在不同系统可能是 eth0/wlan0,也可能是 enp0s3 这类“可预测命名”。
  • ifr_name 有长度限制(IFNAMSIZ),拷贝时要注意结尾 \0
  • socket() 只用于拿到 fd 给 ioctl 用,不需要真正发包。

6. 获取IP

有时候需要获取本机 IP 做显示、上报、或者打印在启动日志里,现场排障会方便很多。这里用 ioctl(SIOCGIFADDR) 获取指定网卡的 IPv4 地址。

代码:

#include<stdio.h>#include<net/if.h>#include<sys/socket.h>#include<sys/ioctl.h>#include<arpa/inet.h>#include<unistd.h>#include<string.h>intget_local_ip(constchar *_ifr_name, char *_ip){int ret = -1;int sockfd;structsockaddr_insin;structifreqifr;    sockfd = socket(AF_INET, SOCK_DGRAM, 0);if (-1 == sockfd)    {printf("socket error\n");return ret;    }strncpy(ifr.ifr_name, _ifr_name, IFNAMSIZ);    ifr.ifr_name[IFNAMSIZ - 1] = 0;if (ioctl(sockfd, SIOCGIFADDR, &ifr) < 0)    {printf("ioctl error\n");        close(sockfd);return ret;    }memcpy(&sin, &ifr.ifr_addr, sizeof(sin));int ip_len = snprintf(_ip, 32"%s", inet_ntoa(sin.sin_addr));    close(sockfd);    ret = ip_len;return ret;}intmain(int argc, char **argv){char ip_str[32] = {0};    get_local_ip("wlan1", ip_str);printf("ip = %s\n", ip_str);return0;}

运行结果:

注意点:

  • 这个方式拿到的是“接口当前配置的 IPv4”。如果网卡还没拿到地址(DHCP 未完成)会失败。
  • 更全面(支持 IPv6/多地址)的做法是 getifaddrs(),但 ioctl 版在嵌入式里更常见、依赖更少。

7. 获取磁盘剩余空间

磁盘空间不足会导致“写文件失败/升级失败/日志丢失”等一堆诡异问题。落盘前先检查一次剩余空间,能少踩很多坑。

代码:

#include<stdio.h>#include<sys/statvfs.h>unsignedlonglongget_fs_free_bytes(constchar *path){structstatvfsst;if (0 != statvfs(path, &st))    {printf("statvfs error\n");return0;    }return (unsignedlonglong)st.f_bsize * (unsignedlonglong)st.f_bavail;}intmain(void){unsignedlonglong free_bytes = get_fs_free_bytes("/");printf("free_bytes = %llu\n", free_bytes);return0;}

注意点:

  • statvfs() 可拿到文件系统块大小和可用块数,换算成字节即可。
  • 嵌入式里常见分区是 //data/userdata 等,按实际挂载点传入。

8. 获取 CPU 使用率(采样计算)

CPU 使用率建议用“采样两次再算差值”的方式,避免读到的是累计值。

代码:

#include<stdio.h>#include<unistd.h>#define PROC_STAT "/proc/stat"staticintread_cpu_stat(unsignedlonglong *idle, unsignedlonglong *total){    FILE *fp = fopen(PROC_STAT, "r");if (NULL == fp)    {printf("fopen error\n");return-1;    }unsignedlonglong user=0,nice=0,system=0,idle_v=0,iowait=0,irq=0,softirq=0,steal=0;int ret = fscanf(fp, "cpu  %llu %llu %llu %llu %llu %llu %llu %llu",                     &user,&nice,&system,&idle_v,&iowait,&irq,&softirq,&steal);    fclose(fp);if (8 != ret)    {printf("fscanf error\n");return-1;    }    *idle = idle_v + iowait;    *total = user + nice + system + idle_v + iowait + irq + softirq + steal;return0;}intmain(void){unsignedlonglong idle1=0,total1=0,idle2=0,total2=0;    read_cpu_stat(&idle1, &total1);    usleep(200 * 1000);    read_cpu_stat(&idle2, &total2);unsignedlonglong idle_delta = idle2 - idle1;unsignedlonglong total_delta = total2 - total1;double cpu_usage = 0;if (total_delta > 0)    {        cpu_usage = (double)(total_delta - idle_delta) * 100.0 / (double)total_delta;    }printf("cpu_usage = %.2f %%\n", cpu_usage);return0;}

注意点:

  • /proc/stat 的 cpu 行是从开机累计到现在的 tick,需要间隔一小段时间读两次再计算。

以上就是本次分享的几个小代码片段。可以这些能力做成一个小工具库(带统一的错误码/日志宏),工程里随手就能复用。

如果觉得文章有帮助,麻烦帮忙转发,谢谢!

猜你喜欢:

收藏!一个不错的嵌入式Linux知识库!

简易嵌入式优先级消息队列设计思路!

这几个嵌入式软件开源项目值得深度复刻!

常见嵌入式软件崩溃类型:12种典型场景!

点击阅读原文,查看我给大家筛选的热门嵌入式书籍!

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-08 14:12:26 HTTP/2.0 GET : https://f.mffb.com.cn/a/463697.html
  2. 运行时间 : 0.330549s [ 吞吐率:3.03req/s ] 内存消耗:4,578.04kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=e959f4061d727e4d01576c5cb920f76f
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000812s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001270s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000590s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000762s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001496s ]
  6. SELECT * FROM `set` [ RunTime:0.019575s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001506s ]
  8. SELECT * FROM `article` WHERE `id` = 463697 LIMIT 1 [ RunTime:0.001606s ]
  9. UPDATE `article` SET `lasttime` = 1770531147 WHERE `id` = 463697 [ RunTime:0.011526s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 65 LIMIT 1 [ RunTime:0.000780s ]
  11. SELECT * FROM `article` WHERE `id` < 463697 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.003930s ]
  12. SELECT * FROM `article` WHERE `id` > 463697 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001517s ]
  13. SELECT * FROM `article` WHERE `id` < 463697 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.019958s ]
  14. SELECT * FROM `article` WHERE `id` < 463697 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.096801s ]
  15. SELECT * FROM `article` WHERE `id` < 463697 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.002451s ]
0.334151s