技术标签: aosp android 操作系统 Android
Android源码中注册服务一般有两种,一种是通过Java实现,另外一种是通过C++实现;本文介绍Native实现方式,Java实现方式请移步 [Android源码添加自定义系统服务 - Java],网上基本上也都是通过Java来自定义实现的。
在./frameworks目录下是没有vendor目录的,vendor目录是新建用于调试的;可以在其它目录下创建测试目录。
aw@m:~/works/android/aosp/aosp11/frameworks/vendor$ tree .
.
└── service
├── aidl
│ └── android
│ └── sample
│ └── ISample.aidl
├── Android.bp
├── include
│ ├── aidl
│ │ ├── BnSample.h
│ │ ├── BpSample.h
│ │ └── ISample.h
│ └── SampleService.h
├── ISample.cpp
├── SampleService.cpp
└── test
├── SampleClient.cpp
└── SampleServer.cpp
7 directories, 10 files
aw@m:~/works/android/aosp/aosp11/frameworks/vendor$
1. 在./frameworks/目录下,创建vendor/service两级目录
2. 在service目录下创建aidl目录,并创建ISample.aidl文件,路径图如上图
aw@m:~/works/android/aosp/aosp11/frameworks/vendor/service/aidl/android/sample$ pwd
/home/aw/works/android/aosp/aosp11/frameworks/vendor/service/aidl/android/sample
aw@m:~/works/android/aosp/aosp11/frameworks/vendor/service/aidl/android/sample$ ls -lhia
总用量 12K
33951777 drwxrwxr-x 2 aw aw 4.0K 11月 20 19:29 .
33951776 drwxrwxr-x 3 aw aw 4.0K 11月 20 19:28 ..
33951779 -rw-rw-r-- 1 aw aw 98 11月 20 19:29 ISample.aidl
aw@m:~/works/android/aosp/aosp11/frameworks/vendor/service/aidl/android/sample$
package android.sample;
interface ISample {
void doSomething(int n, out List<String> output);
}
3. 生成对应的BnSample.cpp、BpSample.cpp、ISample.h、ISample.cpp,文件生成方式有两种:
$: aidl --lang=cpp ./aidl/IAudioSample.aidl -o . -h ./include/
在service目录下创建Android.bp文件,Android.bp
cc_library_shared {
name: "libsampleservice",
aidl: {
export_aidl_headers: true,
local_include_dirs: ["aidl"],
include_dirs: [
"frameworks/vendor/service/aidl",
],
},
srcs: [
":libsample_aidl",
],
shared_libs: [
"libbinder",
"libcutils",
"liblog",
"libutils",
],
export_shared_lib_headers: ["libbinder"],
local_include_dirs: [
"include",
"include/aidl",
"aidl",
],
include_dirs: [
"frameworks/native/include",
"system/core/base/include",
],
header_libs: [
"libbase_headers",
],
cflags: [
"-Werror",
"-Wno-error=deprecated-declarations",
],
}
filegroup {
name: "libsample_aidl",
srcs: [
"aidl/android/sample/ISample.aidl",
],
path: "aidl",
}
在./framworks/vendor下执行mm [Android编译命令],将会在out/soong/.intermediates/frameworks/vendor/service/libsampleservice下生成对应文件
aw@m:~/works/android/aosp/aosp11/out/soong/.intermediates/frameworks/vendor/service/libsampleservice$ ls
android_arm64_armv8-a_shared android_arm_armv8-a_shared
aw@m:~/works/android/aosp/aosp11/out/soong/.intermediates/frameworks/vendor/service/libsampleservice$ tree .
.
├── android_arm64_armv8-a_shared
│ ├── gen
│ │ └── aidl
│ │ ├── android
│ │ │ └── sample
│ │ │ ├── BnSample.h
│ │ │ ├── BpSample.h
│ │ │ └── ISample.h
│ │ └── frameworks
│ │ └── vendor
│ │ └── service
│ │ └── aidl
│ │ └── android
│ │ └── sample
│ │ ├── ISample.cpp
│ │ └── ISample.cpp.d
│ ├── libsampleservice.so
│ ├── libsampleservice.so.d
│ ├── libsampleservice.so.toc
│ ├── libsampleservice.so.toc.d
│ └── unstripped
│ ├── libsampleservice.so
│ └── libsampleservice.so.rsp
└── android_arm_armv8-a_shared
├── gen
│ └── aidl
│ ├── android
│ │ └── sample
│ │ ├── BnSample.h
│ │ ├── BpSample.h
│ │ └── ISample.h
│ └── frameworks
│ └── vendor
│ └── service
│ └── aidl
│ └── android
│ └── sample
│ ├── ISample.cpp
│ └── ISample.cpp.d
├── libsampleservice.so
├── libsampleservice.so.d
├── libsampleservice.so.toc
├── libsampleservice.so.toc.d
└── unstripped
├── libsampleservice.so
└── libsampleservice.so.rsp
取出对应BnSample.h、BpSample.h、ISample.h、ISample.cpp文件
BnSample.h
#ifndef AIDL_GENERATED_ANDROID_SAMPLE_BN_SAMPLE_H_
#define AIDL_GENERATED_ANDROID_SAMPLE_BN_SAMPLE_H_
#include <binder/IInterface.h>
#include <android/sample/ISample.h>
namespace android {
namespace sample {
class BnSample : public ::android::BnInterface<ISample> {
public:
explicit BnSample();
::android::status_t onTransact(uint32_t _aidl_code, const ::android::Parcel& _aidl_data, ::android::Parcel* _aidl_reply, uint32_t _aidl_flags) override;
}; // class BnSample
} // namespace sample
} // namespace android
#endif // AIDL_GENERATED_ANDROID_SAMPLE_BN_SAMPLE_H_
BpSample.h
#ifndef AIDL_GENERATED_ANDROID_SAMPLE_BP_SAMPLE_H_
#define AIDL_GENERATED_ANDROID_SAMPLE_BP_SAMPLE_H_
#include <binder/IBinder.h>
#include <binder/IInterface.h>
#include <utils/Errors.h>
#include <android/sample/ISample.h>
namespace android {
namespace sample {
class BpSample : public ::android::BpInterface<ISample> {
public:
explicit BpSample(const ::android::sp<::android::IBinder>& _aidl_impl);
virtual ~BpSample() = default;
::android::binder::Status doSomething(int32_t n, ::std::vector<::android::String16>* output) override;
}; // class BpSample
} // namespace sample
} // namespace android
#endif // AIDL_GENERATED_ANDROID_SAMPLE_BP_SAMPLE_H_
ISample.h
#ifndef AIDL_GENERATED_ANDROID_SAMPLE_I_SAMPLE_H_
#define AIDL_GENERATED_ANDROID_SAMPLE_I_SAMPLE_H_
#include <binder/IBinder.h>
#include <binder/IInterface.h>
#include <binder/Status.h>
#include <cstdint>
#include <utils/String16.h>
#include <utils/StrongPointer.h>
#include <vector>
namespace android {
namespace sample {
class ISample : public ::android::IInterface {
public:
DECLARE_META_INTERFACE(Sample)
virtual ::android::binder::Status doSomething(int32_t n, ::std::vector<::android::String16>* output) = 0;
}; // class ISample
class ISampleDefault : public ISample {
public:
::android::IBinder* onAsBinder() override {
return nullptr;
}
::android::binder::Status doSomething(int32_t, ::std::vector<::android::String16>*) override {
return ::android::binder::Status::fromStatusT(::android::UNKNOWN_TRANSACTION);
}
}; // class ISampleDefault
} // namespace sample
} // namespace android
#endif // AIDL_GENERATED_ANDROID_SAMPLE_I_SAMPLE_H_
ISample.cpp
#include <aidl/ISample.h>
#include <aidl/BpSample.h>
namespace aidl {
DO_NOT_DIRECTLY_USE_ME_IMPLEMENT_META_INTERFACE(Sample, "aidl.ISample")
} // namespace aidl
#include <aidl/BpSample.h>
#include <aidl/BnSample.h>
#include <binder/Parcel.h>
#include <android-base/macros.h>
namespace aidl {
BpSample::BpSample(const ::android::sp<::android::IBinder>& _aidl_impl)
: BpInterface<ISample>(_aidl_impl){
}
::android::binder::Status BpSample::doSomething(int32_t n, ::std::vector<::android::String16>* output) {
::android::Parcel _aidl_data;
_aidl_data.markForBinder(remoteStrong());
::android::Parcel _aidl_reply;
::android::status_t _aidl_ret_status = ::android::OK;
::android::binder::Status _aidl_status;
_aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor());
if (((_aidl_ret_status) != (::android::OK))) {
goto _aidl_error;
}
_aidl_ret_status = _aidl_data.writeInt32(n);
if (((_aidl_ret_status) != (::android::OK))) {
goto _aidl_error;
}
_aidl_ret_status = remote()->transact(BnSample::TRANSACTION_doSomething, _aidl_data, &_aidl_reply, 0);
if (UNLIKELY(_aidl_ret_status == ::android::UNKNOWN_TRANSACTION && ISample::getDefaultImpl())) {
return ISample::getDefaultImpl()->doSomething(n, output);
}
if (((_aidl_ret_status) != (::android::OK))) {
goto _aidl_error;
}
_aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply);
if (((_aidl_ret_status) != (::android::OK))) {
goto _aidl_error;
}
if (!_aidl_status.isOk()) {
return _aidl_status;
}
_aidl_ret_status = _aidl_reply.readString16Vector(output);
if (((_aidl_ret_status) != (::android::OK))) {
goto _aidl_error;
}
_aidl_error:
_aidl_status.setFromStatusT(_aidl_ret_status);
return _aidl_status;
}
} // namespace aidl
#include <aidl/BnSample.h>
#include <binder/Parcel.h>
#include <binder/Stability.h>
namespace aidl {
BnSample::BnSample()
{
::android::internal::Stability::markCompilationUnit(this);
}
::android::status_t BnSample::onTransact(uint32_t _aidl_code, const ::android::Parcel& _aidl_data, ::android::Parcel* _aidl_reply, uint32_t _aidl_flags) {
::android::status_t _aidl_ret_status = ::android::OK;
switch (_aidl_code) {
case BnSample::TRANSACTION_doSomething:
{
int32_t in_n;
::std::vector<::android::String16> out_output;
if (!(_aidl_data.checkInterface(this))) {
_aidl_ret_status = ::android::BAD_TYPE;
break;
}
_aidl_ret_status = _aidl_data.readInt32(&in_n);
if (((_aidl_ret_status) != (::android::OK))) {
break;
}
::android::binder::Status _aidl_status(doSomething(in_n, &out_output));
_aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply);
if (((_aidl_ret_status) != (::android::OK))) {
break;
}
if (!_aidl_status.isOk()) {
break;
}
_aidl_ret_status = _aidl_reply->writeString16Vector(out_output);
if (((_aidl_ret_status) != (::android::OK))) {
break;
}
}
break;
default:
{
_aidl_ret_status = ::android::BBinder::onTransact(_aidl_code, _aidl_data, _aidl_reply, _aidl_flags);
}
break;
}
if (_aidl_ret_status == ::android::UNEXPECTED_NULL) {
_aidl_ret_status = ::android::binder::Status::fromExceptionCode(::android::binder::Status::EX_NULL_POINTER).writeToParcel(_aidl_reply);
}
return _aidl_ret_status;
}
} // namespace aidl
1. 创建SampleService.h
#ifndef SAMPLE_SERVICE_H
#define SAMPLE_SERVICE_H
#include <BnSample.h>
#include <vector>
namespace android {
class SampleService : public android::sample::BnSample {
public:
SampleService();
~SampleService();
virtual ::android::binder::Status doSomething(int32_t n, ::std::vector<::android::String16>* output);
};
}
#endif
2. 创建SampleService.cpp
#include <SampleService.h>
using namespace android;
SampleService::SampleService() {}
SampleService::~SampleService() {}
::android::binder::Status SampleService::doSomething(int32_t n, ::std::vector<::android::String16>* output) {
for (int i = 0; i < n; i++) {
output->push_back(String16("Hello"));
}
return ::android::binder::Status::ok();
}
3. 修改Android.bp,在srcs中补充了SampleService.cpp源文件
cc_library_shared {
name: "libsampleservice",
aidl: {
export_aidl_headers: true,
local_include_dirs: ["aidl"],
include_dirs: [
"frameworks/vendor/service/aidl",
],
},
srcs: [
":libsample_aidl",
"SampleService.cpp",
],
shared_libs: [
"libbinder",
"libcutils",
"liblog",
"libutils",
],
export_shared_lib_headers: ["libbinder"],
local_include_dirs: [
"include",
"include/aidl",
"aidl",
],
include_dirs: [
"frameworks/native/include",
"system/core/base/include",
],
header_libs: [
"libbase_headers",
],
cflags: [
"-Werror",
"-Wno-error=deprecated-declarations",
],
}
1. 在./framworks/vendor/service/test下创建SampleServer.cpp
#include <sys/types.h>
#include <binder/IPCThreadState.h>
#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
#include <cutils/log.h>
#include <SampleService.h>
using namespace android;
int main(int argc, char** argv) {
sp<ProcessState> proc(ProcessState::self());
sp<IServiceManager> sm = defaultServiceManager();
ALOGI("ServiceManager: %p", sm.get());
sm->addService(String16("SampleService"), new SampleService());
ProcessState::self()->startThreadPool();
IPCThreadState::self()->joinThreadPool();
return 0;
}
1. 在./framworks/vendor/service/test下创建SampleClient.cpp
#include <binder/IServiceManager.h>
#include <binder/Parcel.h>
#include <utils/Errors.h>
#include <stdio.h>
#include <String16.h>
#include <String8.h>
#include <vector>
#include <iostream>
#include <SampleService.h>
using namespace android;
int main () {
sp<android::sample::ISample> sample_srv = interface_cast<android::sample::ISample>(defaultServiceManager()->getService(String16("SampleService")));
std::vector<String16> hellos;
sample_srv->doSomething(3, &hellos);
for (String16 s:hellos ) {
std::cout << String8(s.string()).string() << std::endl;
}
return 0;
}
2. 修改Android.bp
cc_library_shared {
name: "libsampleservice",
aidl: {
export_aidl_headers: true,
local_include_dirs: ["aidl"],
include_dirs: [
"frameworks/vendor/service/aidl",
],
},
srcs: [
":libsample_aidl",
"SampleService.cpp",
],
shared_libs: [
"libbinder",
"libcutils",
"liblog",
"libutils",
],
export_shared_lib_headers: ["libbinder"],
local_include_dirs: [
"include",
"include/aidl",
"aidl",
],
include_dirs: [
"frameworks/native/include",
"system/core/base/include",
],
header_libs: [
"libbase_headers",
],
cflags: [
"-Werror",
"-Wno-error=deprecated-declarations",
],
}
filegroup {
name: "libsample_aidl",
srcs: [
"aidl/android/sample/ISample.aidl",
],
path: "aidl",
}
// Server
cc_binary {
name: "sampleService",
srcs: [
"./test/SampleServer.cpp",
],
local_include_dirs: [
"include",
"include/aidl",
],
include_dirs: [
"frameworks/native/include",
"system/core/base/include",
],
header_libs: [
"libbase_headers",
],
cflags: [
"-Werror",
"-Wno-error=deprecated-declarations",
"-Wall",
"-Wno-unused-parameter",
],
shared_libs: [
"libbinder",
"libcutils",
"liblog",
"libutils",
"libsampleservice",
],
}
// Client
cc_binary {
name: "sampleClient",
srcs: [
"./test/SampleClient.cpp",
],
local_include_dirs: [
"include",
"include/aidl",
],
include_dirs: [
"frameworks/native/include",
"system/core/base/include",
"system/core/include/utils",
],
header_libs: [
"libbase_headers",
],
cflags: [
"-Werror",
"-Wno-error=deprecated-declarations",
"-Wall",
"-Wno-unused-parameter",
],
shared_libs: [
"libbinder",
"libcutils",
"liblog",
"libutils",
"libsampleservice",
],
}
我已经编译过,所以不会有什么生成日志,贴张图让大家知道在哪里执行mm指令 [Android编译命令]
aw@m:~/works/android/aosp/aosp11/frameworks/vendor$ mm
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=11
TARGET_PRODUCT=aosp_bonito
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=generic
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.11.0-40-generic-x86_64-Ubuntu-20.04.3-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=RQ3A.210905.001
OUT_DIR=out
PRODUCT_SOONG_NAMESPACES=device/google/bonito hardware/google/av hardware/google/camera hardware/google/interfaces hardware/google/pixel hardware/qcom/sdm845 vendor/google/camera vendor/qcom/sdm845 vendor/google/interfaces vendor/qcom/bonito/proprietary
============================================
ninja: no work to do.
#### build completed successfully (2 seconds) ####
aw@m:~/works/android/aosp/aosp11/out/soong/.intermediates/frameworks/vendor$ tree .
.
└── service
├── libsampleservice
│ ├── android_arm64_armv8-a_shared
│ │ ├── gen
│ │ │ └── aidl
│ │ │ ├── android
│ │ │ │ └── sample
│ │ │ │ ├── BnSample.h
│ │ │ │ ├── BpSample.h
│ │ │ │ └── ISample.h
│ │ │ └── frameworks
│ │ │ └── vendor
│ │ │ └── service
│ │ │ └── aidl
│ │ │ └── android
│ │ │ └── sample
│ │ │ ├── ISample.cpp
│ │ │ └── ISample.cpp.d
│ │ ├── libsampleservice.so
│ │ ├── libsampleservice.so.d
│ │ ├── libsampleservice.so.toc
│ │ ├── libsampleservice.so.toc.d
│ │ ├── obj
│ │ │ └── frameworks
│ │ │ └── vendor
│ │ │ └── service
│ │ │ ├── SampleService.o
│ │ │ └── SampleService.o.d
│ │ └── unstripped
│ │ ├── libsampleservice.so
│ │ └── libsampleservice.so.rsp
│ └── android_arm_armv8-a_shared
│ ├── gen
│ │ └── aidl
│ │ ├── android
│ │ │ └── sample
│ │ │ ├── BnSample.h
│ │ │ ├── BpSample.h
│ │ │ └── ISample.h
│ │ └── frameworks
│ │ └── vendor
│ │ └── service
│ │ └── aidl
│ │ └── android
│ │ └── sample
│ │ ├── ISample.cpp
│ │ └── ISample.cpp.d
│ ├── libsampleservice.so
│ ├── libsampleservice.so.d
│ ├── libsampleservice.so.toc
│ ├── libsampleservice.so.toc.d
│ ├── obj
│ │ └── frameworks
│ │ └── vendor
│ │ └── service
│ │ ├── SampleService.o
│ │ └── SampleService.o.d
│ └── unstripped
│ ├── libsampleservice.so
│ └── libsampleservice.so.rsp
├── sampleClient
│ └── android_arm64_armv8-a
│ ├── obj
│ │ └── frameworks
│ │ └── vendor
│ │ └── service
│ │ └── test
│ │ ├── SampleClient.o
│ │ └── SampleClient.o.d
│ ├── sampleClient
│ ├── sampleClient.d
│ └── unstripped
│ ├── sampleClient
│ └── sampleClient.rsp
└── sampleService
└── android_arm64_armv8-a
├── obj
│ └── frameworks
│ └── vendor
│ └── service
│ └── test
│ ├── SampleServer.o
│ └── SampleServer.o.d
├── sampleService
├── sampleService.d
└── unstripped
├── sampleService
└── sampleService.rsp
50 directories, 38 files
将libsampleservice.so放到手机 [已root] 的system/lib64和system/lib目录下,重启设备
bonito:/system/lib64 # ls -lhia libsampleservice.so
86 -rwxrwxrwx 1 root root 33K 2021-11-20 20:05 libsampleservice.so
bonito:/system/lib64 # chmod 777 libsampleservice.so
bonito:/system/lib64 # exit
aw@m:~/Downloads$ adb reboot
将sampleService和sampleClient可执行文件放到/data/local/tmp目录下,执行测试,输出三遍Hello表示成功了
bonito:/data/local/tmp # ls
lldb-server localLogcat perfd sampleClient sampleService
bonito:/data/local/tmp # ./sampleService &
[1] 9389
bonito:/data/local/tmp # ./sampleClient
Hello
Hello
Hello
bonito:/data/local/tmp #
文章浏览阅读712次。视频播放器原理 什么是ffmpeg? ffmpeg 音视频编/解码 流程图 ffmpeg 常用 struct AVFormatContext AVStream AVCodecContext AVCodec AVPacket AVFrame ffmpeg 常用Api av_register_all() avformat_alloc_output_context2() avio_open()..._视频效果演示系统的核心技术
文章浏览阅读449次。Java List集合多种情况处理方法:List集合交集、并集、差集、去重、与数组互转、删除、排序等操作_java list reduce
文章浏览阅读2.3k次,点赞77次,收藏80次。需求:指人对客观事务需要的表现,体现为愿望、意向和兴趣,因而成为行动的一种直接原因。软件需求(IEEE软件工程标准词汇表):(1)用户解决问题或达到目标所需的条件或能力。(2)系统或系统部件要满足合同、标准、规范或者其他正式规定文档所需具有条 件或能力。(3)对(1)或(2)中的一个条件或一种能力的一种文档化表述。用例:定义 1 用例是对一个活动者使用一个系统的一项功能时进行交互过程中的一个文字描述序列。_uml需求文档访客管家
文章浏览阅读574次。第三章、Linux根文件系统及文件管理命令详解02_03_Linux根文件系统详解文件系统:rootfs: 根文件系统 FHS:Filesystem Hierarchy Standard(文件系统目录标准)的缩写,多数Linux版本采用这种文件组织形式,类似于Windows操作系统中c盘的文件目录,FHS采用树形结构组织文件。FHS定_根文件系统文本登陆
文章浏览阅读358次。马克 · 扎克伯格期望的元宇宙到底会是什么样子?_马克扎克伯格博客
文章浏览阅读1.4w次,点赞8次,收藏78次。本文接上一篇文章 使用Python开发游戏运行脚本(一)成功调用大漠插件上一篇我们已经简单实现了python调用大漠插件并输出版本号的功能,接下来我们要做的就是通过大漠插件模拟鼠标点击和键盘文字输入。 由于近年来最热门的游戏基本都是手游,所以我们也会以手游为例来进行游戏脚本的开发。大漠插件是一款针对Windows平台的鼠标键盘模拟+图文查找库,这样我们要想实现手游脚本开发的第一步,就是下载Android模拟器,然后在对安卓模拟器进行鼠标和键盘的模拟,以此来实现自动化游戏脚本。一、Android模拟器的_大漠窗口绑定成功按键
文章浏览阅读1k次。 利用Canvas的fillText(),隔一定时间在画布上作画<!DOCTYPE html><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0"> &_canvas画字符雨
文章浏览阅读1.1k次。微信公众号跳转微信小程序,自定义微信跳转标签_opentaglist
文章浏览阅读4.3k次。数据恢复技术与LVM数据恢复方法 1摘要 随着计算机网络应用的发展,数据存储的安全性变的越来越重要。在常见的基于RAID和LVM的环境下面,当出现硬盘故障或者错误操作导致数据丢失的情况下,采用适当的数据恢复策略可以在很大程度上提供数据恢复的成功概率。本文研究了几种情况下的数据恢复技术和方法,为数据恢复和数据安全的预防提供了指导。 2数据恢复需求 2.1Linux IO存储栈 图(1)Linux IO 存储..._vgreduce --removemissing恢复
文章浏览阅读307次。深度学习程序员想年薪百万,基础必须打牢,所以推荐重点书籍Deep Learning花书Deep Learning with PythonDeep Learning for Computer Vision with PythonScikit-Learn与TensorFLow机器学习实用指南深度学习实践Tensorflow机器学习指南..._年薪百万的程序员看什么书
文章浏览阅读1.3k次。一、使用clock()函数,获取毫秒级(ms)时间[1]#include <time.h>//clock()头文件clock_t start = clock();{statement section}//测试代码段clock_t end = clock();printf("the running time is :%fs\n", (double)(end -s..._large_integer nfreq, t1, t2;
文章浏览阅读6.8k次,点赞3次,收藏31次。 前言: 至于用哪个开发工具本文暂且不做任何讨论, 今天着重讲解IntelliJ IDEA这款开发工具的使用 前言:IntelliJ IDEA如果说IntelliJ IDEA是一款现代化智能开发工具的话,Eclipse则称得上是石器时代的东西了。其实笔者也是一枚从Eclipse转IDEA的探索者,随着近期的不断开发实践和调试,逐步..._idea使用视频教程